| random_sample {iNZightTools} | R Documentation |
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.
random_sample(data, n, sample_size)
data |
a dataframe to sample from |
n |
the number of groups to generate |
sample_size |
the size of each group specified in |
a dataframe containing the random samples with tidyverse code attached
Owen Jin, Zhaoming Su
rs <- random_sample(iris, n = 5, sample_size = 3) cat(code(rs)) head(rs)