Data cube creation
Arguments
- .data
data frame to be processed.
- .variables
variables to split data frame by, as a character vector (
c("var1", "var2")
).- .funs_list
a list of function calls in the form of right-hand formula.
- .total
character string with the name to give to the subset of data that includes all the observations of a variable (default:
"Totale"
).- order_type
a function like
extract_unique
orextract_unique2
.- .all
logical, indicating if functions have to be evaluated on the complete dataset.
- fixed_variable
name of the variable for which you do not want to estimate the total
Examples
dcc6(
invented_wages,
.variables = c("gender", "sector"),
.funs_list = list(n = ~dplyr::n()),
.all = TRUE
)
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
#> # A tibble: 9 × 3
#> gender sector n
#> * <fct> <fct> <int>
#> 1 Totale Totale 1000
#> 2 Totale secondary 455
#> 3 Totale tertiary 545
#> 4 men Totale 547
#> 5 men secondary 289
#> 6 men tertiary 258
#> 7 women Totale 453
#> 8 women secondary 166
#> 9 women tertiary 287
dcc6(
invented_wages,
.variables = c("gender", "sector"),
.funs_list = list(n = ~dplyr::n()),
.all = FALSE
)
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
#> # A tibble: 8 × 3
#> gender sector n
#> <fct> <fct> <int>
#> 1 Totale secondary 455
#> 2 Totale tertiary 545
#> 3 men Totale 547
#> 4 men secondary 289
#> 5 men tertiary 258
#> 6 women Totale 453
#> 7 women secondary 166
#> 8 women tertiary 287