subset_save_surveys {retroharmonize}R Documentation

Subset and Save Surveys

Description

Read a predefined survey list and variables.

Usage

subset_save_surveys(
  var_harmonization,
  selection_name = "trust",
  import_path = "",
  export_path = "working"
)

Arguments

var_harmonization

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

selection_name

An identifier for the survey subset.

import_path

The path to the survey files.

export_path

The path where the subsets should be saved.

Value

The function does not return a value. It saves the subsetted surveys into .rds files.

See Also

Other import functions: pull_survey(), read_dta(), read_rds(), read_spss(), read_surveys()

Examples


test_survey <- read_rds (
 file = system.file("examples", "ZA7576.rds",
                    package = "retroharmonize")
)

test_metadata <- metadata_create ( test_survey )
test_metadata <- test_metadata[c(18:37),]
test_metadata$var_name  <- var_label_normalize (test_metadata$var_name_orig)
test_metadata$var_label <- test_metadata$label_orig

saveRDS(test_survey, file.path(tempdir(), 
                              "ZA7576.rds"), 
       version = 2)

subset_save_surveys  ( var_harmonization = test_metadata, 
                      selection_name = "tested",
                      import_path = tempdir(), 
                      export_path = tempdir())

file.exists ( file.path(tempdir(), "ZA7576_tested.rds"))


[Package retroharmonize version 0.2.0 Index]