select_groups | R Documentation |
This returns the selected groups in a dataframe by index number.
select_groups(data, groups, ...)
data |
Dataframe that has already been grouped using dplyr::group_by() |
groups |
Numeric vector of group numbers to use as the indices of the groups to select |
Same format as input dataframe, with only the selected groups, in the order listed. Duplicate group IDs are removed.
# This grabs the first 2 groups listed.
mtcars %>%
group_by(cyl) %>%
select_groups(1:2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.