group_summarize: group_by and summarize as an atomic action.

Description Usage Arguments Value Examples

View source: R/group_summarize.R

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 summarize close together. Author: John Mount, Win-Vector LLC.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
group_summarize(
  d,
  groupingVars,
  ...,
  arrangeTerms = NULL,
  env = parent.frame()
)

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

Arguments

d

data.frame

groupingVars

character vector of column names to group by.

...

list of dplyr::mutate() expressions.

arrangeTerms

character optional vector of quoted column expressions to arrange by.

env

environment to work in.

Value

d summarized by groups

Examples

1
2
3
4
5
group_summarize(datasets::mtcars,
                    c("cyl", "gear"),
                    group_mean_mpg = mean(mpg),
                    group_mean_disp = mean(disp)) %.>%
  head(.)

seplyr documentation built on Sept. 5, 2021, 5:12 p.m.