Learn R Programming

rstatix (version 0.1.1)

sample_n_by: Sample n Rows By Group From a Table

Description

sample n rows by group from a table using the sample_n() function.

Usage

sample_n_by(data, ..., size = 1, replace = FALSE)

Arguments

data

a data frame

...

Variables to group by

size

the number of rows to select

replace

with or without replacement?

Examples

Run this code
# NOT RUN {
ToothGrowth %>% sample_n_by(dose, supp, size = 2)
# }

Run the code above in your browser using DataLab