README.md

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

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))



Try the rollup package in your browser

Any scripts or data that you put into this service are public.

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