group_cols: Select grouping variables

Description Usage Arguments See Also Examples

View source: R/select-helpers.R

Description

This selection helpers matches grouping variables. It can be used in select() or vars() selections.

Usage

1

Arguments

vars

Deprecated; please use data instead.

data

For advanced use only. The default NULL automatically finds the "current" data frames.

See Also

groups() and group_vars() for retrieving the grouping variables outside selection contexts.

Examples

1
2
3
4
5
6
7
gdf <- iris %>% group_by(Species)
gdf %>% select(group_cols())

# Remove the grouping variables from mutate selections:
gdf %>% mutate_at(vars(-group_cols()), `/`, 100)
# -> No longer necessary with across()
gdf %>% mutate(across(everything(), ~ . / 100))

javifar/TIDYVERSE-DPLYR documentation built on Dec. 20, 2021, 9:08 p.m.