group_transmute: group_by and transmute as an atomic action.

View source: R/group_transmute.R

group_transmuteR Documentation

group_by and transmute as an atomic action.

Description

Group a data frame by the groupingVars and compute user summaries on this data frame (user summaries specified in ...). Enforces the good dplyr pipeline design principle of keeping group_by and transmute close together. Author: John Mount, Win-Vector LLC.

Usage

group_transmute(
  d,
  groupingVars,
  ...,
  arrangeTerms = NULL,
  env = parent.frame()
)

Arguments

d

data.frame

groupingVars

character vector of column names to group by.

...

list of dplyr::transmute() expressions.

arrangeTerms

character optional vector of quoted column expressions to arrange by.

env

environment to work in.

Value

d transmuteed by groups

Examples



group_transmute(datasets::mtcars,
                    c("cyl", "gear"),
                    group_mean_mpg = mean(mpg),
                    group_mean_disp = mean(disp)) %.>%
  head(.)


WinVector/seplyr documentation built on Aug. 26, 2022, 12:01 p.m.