crosswalk_surveys | R Documentation |
Harmonize surveys with crosswalk tables.
crosswalk_surveys(
crosswalk_table,
survey_list = NULL,
survey_paths = NULL,
import_path = NULL,
na_values = NULL
)
crosswalk(survey_list, crosswalk_table, na_values = NULL)
crosswalk_table |
A table created with |
survey_list |
A list of surveys imported with |
survey_paths |
A vector of full file paths to the surveys to subset. |
na_values |
A named vector of |
Harmonize a survey or a list of surveys with the help of a crosswalk table.
You can create the crosswalk table with crosswalk_table_create
, or manually
create a crosswalk table as a data frame including at least the following columns: id
for identifying a survey, var_name_orig
for the original variable name
and var_name_target
for the new (target) variable name. Optionally you can harmonize
the value labels, the numeric codes, and the special missing labels, too.
crosswalk
will return a data frame, and crosswalk_surveys
a list of
data frames, where the variable names, and optionally the variable labels, and the missing
value range is harmonized (the same names, labels, codes are used.)
Other harmonization functions:
collect_val_labels()
,
crosswalk_table_create()
,
harmonize_na_values()
,
harmonize_survey_values()
,
harmonize_values()
,
harmonize_var_names()
,
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),
save_to_rds = FALSE)
## Compare with documentation:
documented_surveys <- metadata_surveys_create(example_surveys)
documented_surveys <- documented_surveys[
documented_surveys$var_name_orig %in% c( "rowid", "isocntry", "w1", "qd3_4",
"qd3_8" , "qd7.4", "qd7.8", "qd6.4", "qd6.8"),
]
crosswalk_table <- crosswalk_table_create ( metadata = documented_surveys )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.