| read_csv | R Documentation |
Import a survey dataset stored in comma-separated value ('.csv') format and convert it into a survey-compatible tibble with reproducibility metadata retained as attributes.
read_csv(file, id = NULL, doi = NULL, dataset_bibentry = NULL, ...)
file |
Path to a '.csv' file. |
id |
Optional dataset identifier. When omitted, the file name without extension is used. |
doi |
Optional dataset DOI identifier. |
dataset_bibentry |
Optional bibliographic metadata created with [dataset::dublincore()] or [dataset::datacite()]. |
... |
Additional arguments passed to [utils::read.csv()]. |
The imported object is returned as a tibble with additional survey metadata such as identifiers, DOI references, and optional dataset bibliographic metadata.
A tibble-like survey object with metadata attributes retained for reproducible workflows.
Other import functions:
harmonize_survey_variables(),
pull_survey(),
read_dta(),
read_rds(),
read_spss(),
read_surveys()
# Create a temporary CSV file:
path <- system.file(
"examples",
"ZA7576.rds",
package = "retroharmonize"
)
read_survey <- read_rds(path)
test_csv_file <- tempfile(fileext = ".csv")
write.csv(
x = read_survey,
file = test_csv_file,
row.names = FALSE
)
# Read the CSV file:
re_read <- read_csv(
file = test_csv_file,
id = "ZA7576",
doi = "test_doi"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.