create_hypercube | R Documentation |
create_hypercube
creates a data cube from a flat data table. This is very similar to groupingsets()
in the data.table
package.
create_hypercube(
data,
columns,
drop_sum_columns = "",
use_na = "ifany",
drop_na_levels = TRUE,
label_for_sum = NULL
)
data |
Data object. |
columns |
Character vector, must be more than 1 column provided. |
drop_sum_columns |
Character vector of which columns to drop the 'sum' levels. |
use_na |
Character vector regarding if |
drop_na_levels |
Logical vector, if |
label_for_sum |
Character vector, a label to replace the default text of 'sum' for column totals. |
If drop_na_levels
is set to TRUE
all factor levels which are NA
will be removed. A label can also be set for all the 'sum' levels;
typically these 'sum' levels are NA_character_
but they will not be removed by drop_na_levels
(only NA levels that exist in the data prior to the summarizing
are dropped.
A data.frame
or tibble
is returned
create_hypercube(mtcars, columns = c('gear', 'cyl'), drop_sum_columns = 'cyl')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.