| harmonize_var_names | R Documentation |
The function harmonizes the variable names of surveys (of class survey) that
are imported from an external file as a wave.
harmonize_var_names(
survey_list,
metadata,
old = "var_name_orig",
new = "var_name_suggested",
rowids = TRUE
)
survey_list |
A list of surveys imported with |
metadata |
A metadata table created by |
old |
The column name in |
new |
The column name in |
rowids |
Rename var labels of original vars |
If the metadata that contains subsetting information is subsetted, then
it will subset the surveys in
survey_list.
The list of surveys with harmonized variable names.
crosswalk
Other harmonization functions:
collect_val_labels(),
crosswalk_surveys(),
crosswalk_table_create(),
harmonize_na_values(),
harmonize_survey_values(),
harmonize_values(),
label_normalize()
examples_dir <- system.file("examples", package = "retroharmonize")
survey_list <- dir(examples_dir)[grepl("\\.rds", dir(examples_dir))]
example_surveys <- read_surveys(
file.path( examples_dir, survey_list)
)
metadata <- metadata_create(example_surveys)
metadata$var_name_suggested <- label_normalize(metadata$var_name)
metadata$var_name_suggested[metadata$label_orig == "age_education"] <- "age_education"
harmonize_var_names(survey_list = example_surveys,
metadata = metadata )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.