random_sample | 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
code
rs <- random_sample(iris, n = 5, sample_size = 3)
cat(code(rs))
head(rs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.