Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

ToothGrowth %>% sample_n_by(dose, supp, size = 2)

rstatix

Pipe-Friendly Framework for Basic Statistical Tests

v0.7.0
GPL-2
Authors
Alboukadel Kassambara [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.