Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upgrouping sets #1377
grouping sets #1377
Comments
|
+1 |
RC - Grouping Sets, rollup, cube. #1377
|
|
This is just awesome. Makes working with pivot tables in Shiny way easier. |
Some keywords: GROUPING SETS, ROLLUP, CUBE, GROUPING
Some references: postgres, Oracle, SQL Server, groupings combined with arbitrary functions
Grouping sets and friends are useful to pre-calculate various aggregation levels, which is often desired. Api for that feature in data.table is not very friendly, see Aggregating sub totals and grand totals with data.table.
In case of rollup those are aggregations for provided
byfrom top to bottom. See description from postgres man, and example code below.is equivalent to:
I wonder if there could be cheap speed-up of that process? this is potentially heavy computing task. Would be great to have computation of grouping sets feature developed in C, so all the rollup/cube and other features could be built on top of grouping sets more easily in R still utilizing full speed.
Answers to update when closed:
Some other questions can get new answers also: