Loads a survey from a local file system. Tables are expected as csv files, and a reference (if present) as JSON.
Arguments
- files
a vector of file names as returned by
download_survey()- participant_key
character vector specifying columns that uniquely identify participant observations. For cross-sectional surveys this is typically just
"part_id"(the default). For longitudinal surveys with multiple observations per participant, specify additional columns likec("part_id", "wave"). WhenNULL(the default), the function will auto-detect if additional columns are needed and inform you.- ...
options for
clean(), which is called at the end of this
Value
a survey in the correct format. For longitudinal surveys with
multiple observations per participant, the returned object includes an
observation_key field containing the column names (excluding part_id)
that distinguish observations for the same participant.
Examples
if (FALSE) { # \dontrun{
list_surveys()
peru_files <- download_survey("https://doi.org/10.5281/zenodo.1095664")
peru_survey <- load_survey(peru_files)
# For longitudinal surveys, specify the unique key explicitly:
france_files <- download_survey("https://doi.org/10.5281/zenodo.1157918")
france_survey <- load_survey(france_files,
participant_key = c("part_id", "wave", "studyDay")
)
} # }