.funs: A function fun, a quosure style lambda ~ fun(.) or a list of either form.
...: Additional arguments for the function calls in .funs. These are evaluated only once, with tidy dots support.
.add: See group_by()
.drop: Drop groups formed by factor levels that don't appear in the data? The default is TRUE except when .data has been previously grouped with .drop = FALSE. See group_by_drop_default() for details.
.vars: A list of columns generated by vars(), a character vector of column names, a numeric vector of column positions, or NULL.
.predicate: A predicate function to be applied to the columns or a logical vector. The variables for which .predicate is or returns TRUE are selected. This argument is passed to rlang::as_function() and thus supports quosure-style lambda functions and strings representing function names.
Grouping variables
Existing grouping variables are maintained, even if not included in the selection.
Examples
# Group a data frame by all variables:group_by_all(mtcars)# ->mtcars %>% group_by(pick(everything()))# Group by variables selected with a predicate:group_by_if(iris, is.factor)# ->iris %>% group_by(pick(where(is.factor)))# Group by variables selected by name:group_by_at(mtcars, vars(vs, am))# ->mtcars %>% group_by(pick(vs, am))# Like group_by(), the scoped variants have optional mutate# semantics. This provide a shortcut for group_by() + mutate():d <- tibble(x=c(1,1,2,2), y=c(1,2,1,2))group_by_all(d, as.factor)# ->d %>% group_by(across(everything(), as.factor))group_by_if(iris, is.factor, as.character)# ->iris %>% group_by(across(where(is.factor), as.character))