powered by
This selection helper matches grouping variables. It can be used within select() and relocate() selections.
select()
relocate()
group_cols()
groups() and group_vars() for retrieving the grouping variables outside selection contexts.
groups()
group_vars()
mtcars %>% group_by(am, cyl) %>% select(group_cols())
Run the code above in your browser using DataLab