nth_group | R Documentation |
Inspired by this SO answer.
nth_group(x, n)
x |
grouped data frame |
n |
index(es) of the group(s) to extract |
subset of groups from the input dataframe
## Not run:
# extract first group
mtcars %>% group_by(cyl) %>% nth_group(1)
# extract first and third group
mtcars %>% group_by(cyl) %>% nth_group(c(1,3))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.