Description Usage Arguments Value Examples
Groups a dataframe by the specified feature, selects n of these groups and discards the rest. Returned dataframe is ungrouped.
1 | sample_n_groups(df, group_var, n)
|
df |
A data frame or data frame like object recognized by |
group_var |
Feature to group by. Uses NSE like dplyr verbs. |
n |
Number of groups to take. If there are fewer than |
Dataframe with n random groups selected according to specified grouping feature.
1 | sample_n_groups(mtcars, cyl, 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.