merge multiple LISS modules into a single panel dataset
Source:R/liss_merge_engine.R
merge_liss_panel.Rdtakes the output of merge_liss_modules() (or a list of per-module
data frames) and joins them into one wide dataset keyed by respondent
and wave year. module-specific columns are prefixed with the module
code (e.g. ch_s004, cv_s004) to avoid name collisions.
Arguments
- results
either the named list returned by
merge_liss_modules()(where each element has a$datatibble), or a named list of data frames directly. names should be module codes (e.g."ch","cv").- join_by
character vector of columns to join on. defaults to
c("nomem_encr", "wave_year").character vector of additional columns to keep unprefixed (carried from the first module that has them). defaults to
c("nohouse_encr").- join_type
character. type of join:
"full"(default),"inner", or"left"(keeps all rows from the first module).- write_to
optional file path. if provided, the merged panel is written as SAV (SPSS format, preserving labels). should end in
.sav.
Examples
if (FALSE) { # \dontrun{
results <- merge_liss_modules(recipe_paths, data_dir = "~/Downloads/liss")
panel <- merge_liss_panel(results)
panel <- merge_liss_panel(results, write_to = "./output/liss_panel.sav")
} # }