Calculates aggregates functions for groups of variables and all their combinations
cube(df, groups = NULL, ..., .totals = "Total")
df | A dataframe |
---|---|
groups | variables names |
... | calculations passed to `dplyr::summarize(...)` |
.totals | A string of how output totals are labeled in the rows and cols |
#> # A tibble: 12 x 3 #> cyl am Avg #> <chr> <chr> <dbl> #> 1 4 0 22.9 #> 2 4 1 28.1 #> 3 6 0 19.1 #> 4 6 1 20.6 #> 5 8 0 15.0 #> 6 8 1 15.4 #> 7 4 Total 26.7 #> 8 6 Total 19.7 #> 9 8 Total 15.1 #> 10 Total 0 17.1 #> 11 Total 1 24.4 #> 12 Total Total 20.1