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

Description Usage Arguments Author(s) See Also Examples

View source: R/qualtrics_register_options.R

Description

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 or https://github.com/ropensci/qualtRics/blob/master/README.md#using-a-configuration-file . 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

1
2
3
4
5
6
registerOptions(verbose = TRUE, useLabels = TRUE, convertVariables = TRUE,
  useLocalTime = FALSE, dateWarning = TRUE, ...)

qualtrics_register_options(verbose = TRUE, useLabels = TRUE,
  convertVariables = TRUE, useLocalTime = FALSE, dateWarning = TRUE,
  api_key = NULL, base_url = NULL, ...)

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.

Author(s)

Jasper Ginn

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## 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],
                      saveDir = 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],
                      saveDir = tempdir(),
                      startDate = "2017-01-01",
                      endDate = "2017-01-31",
                      limit = 100,
                      seenUnansweredRecode = "UNANS")

## End(Not run)

JasperHG90/qualtRics documentation built on May 7, 2019, 10:33 a.m.