View source: R/harmonize_survey_variables.R
harmonize_survey_variables | R Documentation |
Similar to subset_surveys
, but will not only remove the
variables that cannot be harmonized, but also renames the variables that are kept.
harmonize_survey_variables(
crosswalk_table,
subset_name = "subset",
survey_list = NULL,
survey_paths = NULL,
import_path = NULL,
export_path = NULL
)
crosswalk_table |
A crosswalk table created by |
subset_name |
An identifier for the survey subset. |
survey_list |
A list of surveys imported with |
survey_paths |
A vector of full file paths to the surveys to subset. |
A list of surveys or save individual rds files on the export_path
.
{
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),
export_path = NULL)
documented_surveys <- metadata_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 )
freedom_table <- crosswalk_table[
which(crosswalk_table$var_name_target %in% c("rowid", "freedom")),
]
harmonize_survey_variables(crosswalk_table = freedom_table,
subset_name = 'freedom',
survey_list = example_surveys )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.