Learn R Programming

iNZightTools (version 1.13.0)

filterRandom: 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

filterRandom(.data, n, sample_size)

Value

a dataframe containing the random samples with tidyverse code attached

Arguments

.data

a dataframe to sample from

n

the number of groups to generate

sample_size

the size of each group specified in n

Author

Owen Jin

See Also

code

Examples

Run this code
filtered <- filterRandom(iris, n = 5, sample_size = 3)
cat(code(filtered))
head(filtered)

Run the code above in your browser using DataLab