with_cube: with_cube

View source: R/rollup.R

with_cubeR Documentation

with_cube

Description

Compute total amounts at different group levels, producing multiple subtotals. With the 'with_cube' clause following 'group_by', you can aggregate multiple grouping variables in one operation. This reflects the 'WITH CUBE' operations in 'SQL'.

Usage

with_cube(grouped_df)

Arguments

grouped_df

'grouped_df' class

Value

A list of 'grouped_df' class. each 'grouped_df' object has a different grouping level.

Examples

mtcars %>% group_by(vs, am) %>% grouping_sets("vs","am",c("vs","am"))
mtcars %>% group_by(vs, am) %>% with_rollup() 
mtcars %>% group_by(vs, am) %>% with_cube() 

rollup documentation built on Sept. 12, 2024, 7:28 a.m.