qualtRics (version 0.3)

getSurvey: Export a survey and download into R

Description

Export a qualtrics survey you own and import the survey directly into R. NOTE: If you keep getting errors try to use your institution's base URL. See https://api.qualtrics.com/docs/root-url.

Usage

getSurvey(surveyID, root_url, format = c("csv", "json", "xml", "spss"), save_dir = tempdir(), verbose = FALSE)

Arguments

surveyID
Unique ID for the survey you want to download. Returned as 'id' by the getSurveys function.
root_url
Base url for your institution (see https://api.qualtrics.com/docs/csv. You need to supply this url. Your query will NOT work without it.)
format
Type of file that will be downloaded. CSV will return a data frame, JSON and XML will return a list. SPSS is currently not supported. Defaults to CSV.
save_dir
Directory where survey results will be stored. Defaults to a temporary directory which is cleaned when your R session is terminated. This parameter is useful if you'd like to store survey results.
verbose
Print verbose messages to the R console? Defaults to FALSE

See Also

See https://api.qualtrics.com/docs/csv for documentation on the Qualtrics API.

Examples

Run this code
## Not run: 
# registerApiKey("<YOUR-QUALTRICS-API-KEY>")
# surveys <- getSurveys("https://leidenuniv.eu.qualtrics.com")
#                       # URL is for my own institution.
#                       # Substitute with your own institution's url
# mysurvey <- getSurvey(surveys$id[6],
#                       format = "csv",
#                       save_dir = tempdir(),
#                       "https://leidenuniv.eu.qualtrics.com",
#                       verbose=TRUE)
# ## End(Not run)

Run the code above in your browser using DataLab