R/nth_group.R
nth_group.Rd
Inspired by this SO answer.
nth_group(x, n)
grouped data frame
index(es) of the group(s) to extract
subset of groups from the input dataframe
if (FALSE) { # \dontrun{ # extract first group mtcars %>% group_by(cyl) %>% nth_group(1) # extract first and third group mtcars %>% group_by(cyl) %>% nth_group(c(1,3)) } # }