Convert table description to variable lists
Source:R/tabuler_et_appliquer_ckm_sur_liste.R
convert_desc_table_to_list.Rd
This function converts a table description data frame into lists of categorical and hierarchical variables for multiple tables.
Value
A list containing:
tableaux: vector of table names
list_cat_vars: list of categorical variables for each table
list_hrc_vars: list of hierarchical variables for each table
Examples
# Create example table description
desc_tableaux <- data.frame(
TAB = c(rep(1,3), rep(2,4)),
VAR = c("DIPLOME", "SEXE", "AGE", "DIPLOME", "TYPE", "REG", "DEP"),
HRC = c(rep(NA, 5), rep("GEO",2))
)
convert_desc_table_to_list(desc_tableaux)
#> $tableaux
#> [1] "tab_1" "tab_2"
#>
#> $list_cat_vars
#> $list_cat_vars$tab_1
#> [1] "DIPLOME" "SEXE" "AGE"
#>
#> $list_cat_vars$tab_2
#> [1] "DIPLOME" "TYPE"
#>
#>
#> $list_hrc_vars
#> $list_hrc_vars$tab_2
#> $list_hrc_vars$tab_2$GEO
#> [1] "REG" "DEP"
#>
#>
#>