random_sample: Random sampling without replacement

View source: R/sample.R

random_sampleR 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 n

Value

a dataframe containing the random samples with tidyverse code attached

Author(s)

Owen Jin, Zhaoming Su

See Also

code

Examples

rs <- random_sample(iris, n = 5, sample_size = 3)
cat(code(rs))
head(rs)


iNZightTools documentation built on Oct. 12, 2023, 5:06 p.m.