read_survey {qualtRics} | R Documentation |
Read a CSV file exported from Qualtrics
Description
Reads comma separated CSV files generated by Qualtrics software. The second line containing the variable labels is imported. Repetitive introductions to matrix questions are automatically removed. Variable labels are stored as attributes.
Usage
read_survey(
file_name,
strip_html = TRUE,
import_id = FALSE,
time_zone = NULL,
legacy = FALSE,
add_column_map = TRUE,
add_var_labels = TRUE,
col_types = NULL
)
Arguments
file_name |
String. A CSV data file. |
strip_html |
Logical. If |
import_id |
Logical. If |
time_zone |
String. A local timezone to determine response date values.
Defaults to |
legacy |
Logical. If |
add_column_map |
Logical. If |
add_var_labels |
Logical. If |
col_types |
Optional. This argument provides a way to manually overwrite
column types that may be incorrectly guessed. Takes a |
Value
A data frame. Variable labels are stored as attributes. They are not printed on the console but are visibile in the RStudio viewer.
Examples
## Not run:
# Generic use of read_survey()
df <- read_survey("<YOUR-PATH-TO-CSV-FILE>")
## End(Not run)
# Example using current data format
file <- system.file("extdata", "sample.csv", package = "qualtRics")
df <- read_survey(file)
# Example using legacy data format
file <- system.file("extdata", "sample_legacy.csv", package = "qualtRics")
df <- read_survey(file, legacy = TRUE)
# Example changing column type
file <- system.file("extdata", "sample.csv", package = "qualtRics")
# Force EndDate to be a string
df <- read_survey(file, col_types = readr::cols(EndDate = readr::col_character()))