cube_ | R Documentation |
Create a data cube and store it in a list
cube_(.data, .vars, sep = ".", fun_list = list(n = ~nrow(.data)), ...)
.data |
a data frame. |
.vars |
character vector with the names of the columns for which the data frame will be divided. |
sep |
a character string to separate the terms. |
fun_list |
a named list of formulas with the desired function calls to
be evalutated on the data frame. The default value ( |
... |
additional optional arguments passed to |
a list whose elements are data frame containing the estimates for each combination of variables.
data(invented_wages)
str(invented_wages)
# First create a list of function calls (with formulas) and
# a vector with names of the desired variables
fun <- list(m1 = ~weighted.mean(wage, sample_weights), s = ~sum(sample_weights))
vars <- c("gender", "sector")
# And then create the data cube, with the estimates of all the combinations
# of variables
cube_(invented_wages, .vars = vars, fun_list = fun)
cube_(invented_wages, .vars = vars, fun_list = fun,
estimator_name = "statistica", value = "stima")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.