| read_csv | R Documentation |
Import survey data from a comma-separated values (CSV) file into a survey data frame with reproducibility metadata.
read_csv(file, id = NULL, doi = NULL, dataset_bibentry = NULL, ...)
file |
Path to a CSV file. |
id |
Optional survey identifier. If omitted, the file path without its extension is used. |
doi |
Optional digital object identifier (DOI). If omitted, the first value of the 'doi' column is used, when available. |
dataset_bibentry |
Optional bibliographic metadata created with [dataset::dublincore()] or [dataset::datacite()]. |
... |
Reserved for additional import arguments. Currently unused. |
The CSV file must contain a 'rowid' column identifying the observations. Character variables may be converted into defined categorical variables.
If the file cannot be parsed, a warning is issued and an empty survey object is returned.
A 'survey_df' object with survey identifiers, bibliographic metadata, source filename, object size, and source file size. An empty 'survey' object is returned if the file cannot be parsed.
Other import functions:
harmonize_survey_variables(),
pull_survey(),
read_dta(),
read_rds(),
read_spss(),
read_surveys()
path <- system.file(
"examples",
"ZA7576.rds",
package = "retroharmonize"
)
example_survey <- read_rds(path)
csv_file <- tempfile(fileext = ".csv")
utils::write.csv(
x = example_survey,
file = csv_file,
row.names = FALSE
)
imported_survey <- read_csv(
file = csv_file,
id = "ZA7576"
)
unlink(csv_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.