read_csv: Read csv file

View source: R/read_csv.R

read_csvR Documentation

Read csv file

Description

Import a survey from a csv file.

Usage

read_csv(file, id = NULL, doi = NULL, dataset_bibentry = NULL, ...)

Arguments

file

A path to a file to import.

id

An identifier of the tibble, if omitted, defaults to the file name without its extension.

doi

An optional document object identifier.

dataset_bibentry

A bibliographic entry created with dataset::dublincore or dataset::datacite.

...

Further optional parameters to pass on to utils::read.csv.

Value

A tibble, data frame variant with survey attributes.

See Also

Other import functions: pull_survey(), read_dta(), read_rds(), read_spss(), read_surveys()

Examples

# Create a temporary CSV file:
path <-  system.file("examples", "ZA7576.rds", package = "retroharmonize")
read_survey <- read_rds(path)
test_csv_file <- tempfile()
write.csv(x = read_survey, file = test_csv_file, row.names = F)

# Create a Bibentry:
survey_bibentry <- dublincore(
          title = "Test Survey", 
          creator = person("Jane", "Doe", role = "cre")
          )

# Read the CSV file:           
re_read <- read_csv(
           file=test_csv_file,
           dataset_bibentry = survey_bibentry,
           id = "ZA7576", doi = "test_doi")

antaldaniel/retroharmonize documentation built on Dec. 31, 2024, 9:52 p.m.