| read_rds | R Documentation |
Import a serialized survey object stored in '.rds' format and return it as a 'survey' object with harmonized metadata attributes.
read_rds(file, dataset_bibentry = NULL, id = NULL, doi = NULL)
file |
Path to an '.rds' file containing a survey object. |
dataset_bibentry |
Optional bibliographic metadata created with [dataset::dublincore()] or [dataset::datacite()]. |
id |
Optional survey identifier. Defaults to the file name without extension. |
doi |
Optional DOI identifier for the survey. |
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.
A 'survey' object inheriting from 'data.frame' and 'tbl_df' with survey metadata attributes.
Other import functions:
harmonize_survey_variables(),
pull_survey(),
read_csv(),
read_dta(),
read_spss(),
read_surveys()
path <- system.file(
"examples",
"ZA7576.rds",
package = "retroharmonize"
)
survey_object <- read_rds(path)
attr(survey_object, "id")
attr(survey_object, "filename")
attr(survey_object, "doi")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.