https://github.com/hadley/dplyr
Raw File
Tip revision: 3665fafc17aca6a72282498e631a04bb18e738ca authored by Hadley Wickham on 31 March 2020, 18:51:49 UTC
Ensure that bind_cols() always returns the type of the LHS
Tip revision: 3665faf
group_cols.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/select-helpers.R
\name{group_cols}
\alias{group_cols}
\title{Select grouping variables}
\usage{
group_cols(vars = NULL, data = NULL)
}
\arguments{
\item{vars}{Deprecated; please use data instead.}

\item{data}{For advanced use only. The default \code{NULL} automatically
finds the "current" data frames.}
}
\description{
This selection helpers matches grouping variables. It can be used
in \code{\link[=select]{select()}} or \link[=scoped]{vars()} selections.
}
\examples{
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))
}
\seealso{
\code{\link[=groups]{groups()}} and \code{\link[=group_vars]{group_vars()}} for retrieving the grouping
variables outside selection contexts.
}
back to top