A Tidy Grouping Set Aggregation

A Tidy implementation of 'grouping sets', 'rollup' and 'cube' - extensions of the 'group_by' clause that allow for computing multiple 'group_by' clauses in a single statement. For more detailed information on these functions, please refer to "Enhanced Aggregation, Cube, Grouping and Rollup" < https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C+Grouping+and+Rollup>.


rollup

rollup: A Tidy implementation of grouping sets, rollup and cube, which are extensions of the group_by clause that compute multiple group_by clauses in a single statement.

Install

# From CRAN
install.packages("rollup")

# From Github
devtools::install_github("JuYoungAhn/rollup")

CRAN_Download_Badge

In a Nutshell

  • If you want to learn more about rollup, please refer to the Tutorial.
mtcars %>% group_by(vs, am) %>% grouping_sets("vs","am",c("vs","am"),NA) %>% 
  summarize(n=n(), avg_mpg=mean(mpg))

mtcars %>% group_by(vs, am) %>% with_rollup() %>% 
  summarize(n=n(), avg_mpg=mean(mpg))

mtcars %>% group_by(vs, am) %>% with_cube() %>% 
  summarize(n=n(), avg_mpg=mean(mpg))

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rollup")

0.1.0 by Ju Young Ahn, 2 years ago


https://juyoungahn.github.io/rollup/


Browse source code at https://github.com/cran/rollup


Authors: Ju Young Ahn [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports rlang, methods, utils, magrittr, sparklyr

Depends on dplyr, tidyr

Suggests knitr, rmarkdown


See at CRAN