cube_df_ | R Documentation |
Create a data cube and store it in a data frame
cube_df_(
.data,
.vars,
sep = ".",
fun_list = list(n = ~nrow(.data)),
.total = "Totale",
...
)
.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 ( |
.total |
character string with the value to give to the "total" combinations (default: "Totale") |
... |
additional optional arguments passed to |
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_df_(invented_wages, .vars = vars, fun_list = fun)
cube_df_(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.