zummarise: Summarises and then ungroups a tbl

View source: R/zummarise.R

zummariseR Documentation

Summarises and then ungroups a tbl

Description

When I first started using dplyr, I thought summarise would completely ungroup the object it was called on. Later, I learned that it only peeled back the last-named grouping argument. To make sure my code was doing what I wanted it to, I created this function as a way of implementing what I thought summarise actually did

Usage

zummarise(.data, ...)

Arguments

.data

A tbl. I believe that all main verbs are S3 generics and provide methods for tbl_df, etc., since this is built on dplyr code.

...

From dplyr: Name-value pairs of summary functions. 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)).

These arguments are automatically quoted and evaluated in the context of the data frame. They support unquoting and splicing. See vignette("programming") for an introduction to these concepts.

Value

An object of the same class as .data. All grouping levels will be dropped.

Data frame row names are silently dropped. To preserve, convert to an explicit variable.

Examples

zummarise(dplyr::group_by(mtcars, cyl, gear), mean(disp))

burchill/zplyr documentation built on Feb. 2, 2023, 11:01 a.m.