res2df | R Documentation |
Put the results of 'split_apply_' in a data frame
res2df(.nested_list, sep = ".", estimator_name = "estimator", value = "value")
.nested_list |
a nested list, the output of |
sep |
a character string to separate the terms. |
estimator_name |
character string with the name to be given to the column with the type of the estimated statistics (default: "estimator"). |
value |
character string with the name of the column that will contain the values of the estimated statistics (default: "value"). |
a data frame
data(invented_wages)
str(invented_wages)
# First create a list of function calls (with formulas)
fun <- list(m1 = ~weighted.mean(wage, sample_weights), s = ~sum(sample_weights))
# And then apply them to subsets of data defined by the combinations of variables
tmp <- split_apply_(invented_wages, .vars = c("gender", "sector"), fun_list = fun)
str(tmp) # a list
res2df(tmp) # a data frame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.