random_sample {iNZightTools} | R Documentation |
Random sampling without replacement
Description
Take a specified number of groups of observations with fixed group size by sampling without replacement and returns the result along with tidyverse code used to generate it.
Usage
random_sample(data, n, sample_size)
Arguments
data |
a dataframe to sample from |
n |
the number of groups to generate |
sample_size |
the size of each group specified in |
Value
a dataframe containing the random samples with tidyverse code attached
Author(s)
Owen Jin, Zhaoming Su
See Also
Examples
rs <- random_sample(iris, n = 5, sample_size = 3)
cat(code(rs))
head(rs)
[Package iNZightTools version 2.0.1 Index]