get_survey_data: Download a labeled survey data set

View source: R/get_survey_data.R

get_survey_dataR Documentation

Download a labeled survey data set

Description

Download a survey data set from Qualtrics corresponding to a variable dictionary generated by dict_generate. Question, items, levels and labels are added as attributes using sjlabelled.

Usage

get_survey_data(dict, keys = NULL, split_by_block = FALSE, skip = NULL, ...)

Arguments

dict

A variable dictionary returned by dict_generate.

keys

A character vector containing variables to be added, if split_by_block is TRUE, to all individual block data sets. Can also be used to add variables (e.g. IP address) found on Qualtrics but not in the dictionary to the downloaded data sets.

split_by_block

Logical. If TRUE, the function returns a list with each element being the data set for a single survey block.

skip

Logical. If TRUE, variables with potenetial level-label mistakes will be removed from the data set.

...

Other arguments passed to fetch_survey. Note that surveyID, import_id, convert, label and include_qids will be overwritten by the function.

Value

A dataframe containing survey data with question, items, levels and labels added as attributes to each column with sjlabelled.

Examples

## Not run: 

# Generate a dictionary
mydict <- dict_generate("SV_4YyAHbAxpdbzacl",
  survey_name = "mysurvey",
  var_name = "easy_name",
  block_pattern = block_pattern,
  block_sep = ".",
  split_by_block = FALSE
)
survey_dat <- get_survey_data(mydict,
  unanswer_recode = -77,
  unanswer_recode_multi = 0
)

## End(Not run)

lyh970817/qualtdict documentation built on April 8, 2023, 9:26 p.m.