View source: R/merge_surveys.R
merge_surveys | R Documentation |
Merge a list of surveys into a list with harmonized variable names, variable labels and survey identifiers.
merge_surveys(survey_list, var_harmonization)
merge_waves(waves, var_harmonization)
survey_list |
A list of surveys |
var_harmonization |
Metadata of surveys, including at least
|
waves |
Deprecated. |
The function was called till version 0.2.0 merge_waves()
,
which reflects the vocabulary of Eurobarometer surveys.
A list of surveys with harmonized names and variable labels.
survey
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)
metadata <- metadata_surveys_create(example_surveys)
require(dplyr)
to_harmonize <- metadata %>%
filter ( var_name_orig %in%
c("rowid", "w1") |
grepl("^trust", label_orig ) ) %>%
mutate ( var_label = var_label_normalize(label_orig) ) %>%
mutate ( var_name_target = val_label_normalize(var_label) ) %>%
mutate ( var_name_target = ifelse(.data$var_name_orig %in% c("rowid", "w1", "wex"),
.data$var_name_orig, .data$var_name_target) )
merge_surveys ( example_surveys, to_harmonize )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.