Import a serialized survey object stored in `.rds` format and return it as a `survey` object with harmonized metadata attributes.
Details
This function restores survey objects previously saved with [base::saveRDS()] or exported from the `retroharmonize` workflow. The returned object retains survey metadata and gains additional provenance attributes such as source file name and file size.
If the file cannot be read, an empty `survey` object is returned and a warning is emitted.
The function:
- restores the serialized object, - validates source file information, - normalizes `rowid`, - records provenance metadata, - and stores object and source file sizes as attributes.
See also
Other import functions:
harmonize_survey_variables(),
pull_survey(),
read_csv(),
read_dta(),
read_spss(),
read_surveys()
Examples
path <- system.file(
"examples",
"ZA7576.rds",
package = "retroharmonize"
)
survey_object <- read_rds(path)
attr(survey_object, "id")
#> [1] "ZA7576"
attr(survey_object, "filename")
#> [1] "ZA7576.rds"
attr(survey_object, "doi")
#> [1] "doi:10.4232/1.13393"
