Learn R Programming

qualtRics (version 3.1.1)

registerOptions: Register Qualtrics API Key, Base Url and Other Options

Description

This function is soft deprecated; use qualtrics_api_credentials instead. This function registers the user's qualtrics API key, base url and other options for the remainder of the R session. This function only needs to be called once (at the beginning of each R session). You may also use a configuration file. See qualtRicsConfigFile. Note that you must pass both an api token and a base url if you call this function for the first time in a session and you're not using a config file. Thereafter, you can pass these options individually.

Usage

registerOptions(verbose = TRUE, useLabels = TRUE,
  convertVariables = TRUE, useLocalTime = FALSE, dateWarning = TRUE,
  ...)

Arguments

verbose

Logical. If TRUE, verbose messages will be printed to the R console. Defaults to TRUE.

useLabels

Logical. TRUE to export survey responses as Choice Text or FALSE to export survey responses as values.

convertVariables

Logical. If TRUE, then the getSurvey function will convert certain question types (e.g. multiple choice) to proper data type in R. Defaults to TRUE.

useLocalTime

Logical. Use local timezone to determine response date values? Defaults to FALSE. See https://api.qualtrics.com/docs/dates-and-times for more information.

dateWarning

Logical. Once per session, qualtRics will emit a warning about date conversion for surveys. You can turn this warning off by changing the flag to FALSE. Defaults to TRUE.

...

Either one or both of 'api_token' and 'base_url' to register the Qualtrics api key and institution-specific root url manually. (see example). See also qualtRicsConfigFile for an explanation of the root_url and api_token parameters.

See Also

See https://github.com/ropensci/qualtRics/blob/master/README.md#using-a-configuration-file for more information about the qualtRics configuration file. See: https://api.qualtrics.com/docs/authentication to find your Qualtrics API key and https://api.qualtrics.com/docs/root-url for more information about the institution-specific root url.

Examples

Run this code
# NOT RUN {
# Register your Qualtrics credentials if you haven't already
# Note that you need to pass both the 'api_token' and 'base_url'
# parameters if you call this function for the first time.
registerOptions(
  api_token = "<YOUR-API-TOKEN>",
  base_url = "<YOUR-ROOT-URL>"
)
# Register a different root url
registerOptions(base_url = "<YOUR-OTHER-ROOT-URL>")
# Retrieve a list of surveys
surveys <- getSurveys()
# Retrieve a single survey
mysurvey <- getSurvey(
  surveyID = surveys$id[6],
  save_dir = tempdir(),
  verbose = TRUE
)
# You can use the same parameters as those found in the qualtrics API documentation
# Found here: https://api.qualtrics.com/docs/csv
mysurvey <- getSurvey(
  surveyID = surveys$id[6],
  save_dir = tempdir(),
  startDate = "2017-01-01",
  endDate = "2017-01-31",
  limit = 100,
  seenUnansweredRecode = "UNANS"
)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab