summarise_total: Summarise with totals

Description Usage Arguments Value See Also Examples

Description

A version of dplyr's summarise function that provides an additional total row.

Usage

1
summarise_total(df, label = "Total", ...)

Arguments

df

A grouped date.frame.

label

The label to use in the grouping columns of the 'Total' row. Defaults to 'Total'.

...

Name-value pairs of summary functions, as for dplyr:summarise. The name will be the name of the variable in the result. The value should be an expression that returns a single value like min(x), n(), or sum(is.na(y)).

Value

A data.frame containing a row of summary statistics for each group, plus a 'Total' row.

See Also

summarise

Examples

1
2
iris %>% group_by(Species) %>% summarise(n = n(), `Mean Sepal Length` = mean(Sepal.Length))
iris %>% group_by(Species) %>% summarise_total(n = n(), `Mean Sepal Length` = mean(Sepal.Length))

leebunce/leebunce documentation built on May 20, 2019, 4:06 p.m.