merge_waves: Merge waves

Description Usage Arguments Value See Also Examples

View source: R/merge_waves.R

Description

Merge a list of surveys into a list with harmonized variable names, variable labels and survey identifiers.

Usage

1
merge_waves(waves, var_harmonization)

Arguments

waves

A list of surveys

var_harmonization

Metadata of surveys, including at least filename, var_name_orig, var_name, var_label.

Value

A list of surveys with harmonized names and variable labels.

See Also

survey

Other harmonization functions: collect_val_labels(), harmonize_na_values(), harmonize_values(), harmonize_waves(), label_normalize(), na_range_to_values()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
require(dplyr)
survey_list <- dir (
    here( "inst", "examples"))[grepl(".rds", 
                        dir (here( "inst", "examples")))]
                        
example_surveys <- read_surveys(
    here( "inst", "examples", survey_list))
    
metadata <- lapply ( X = example_surveys, FUN = metadata_create )
metadata <- do.call(rbind, metadata)
 
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 = val_label_normalize(var_label) )

merge_waves ( example_surveys, to_harmonize )

## End(Not run)

antaldaniel/retroharmonize documentation built on Aug. 15, 2020, 10:13 a.m.