If summarise_plus()
is used with the nested options "all" or "single", three
variables are automatically generated: TYPE, TYPE_NR and DEPTH. With this functions
these variables are dropped.
Examples
# Example format
sex. <- discrete_format(
"Total" = 1:2,
"Male" = 1,
"Female" = 2)
# Example data frame
my_data <- dummy_data(1000)
# Call function
all_possible <- my_data |>
summarise_plus(class = c(year, sex),
values = c(income, probability),
statistics = c("sum", "mean", "freq"),
formats = list(sex = "sex."),
weight = weight,
nesting = "all",
na.rm = TRUE) |>
drop_type_vars()