Qualtrics < https://www.qualtrics.com/about/> allows users to collect online data through surveys. This package contains convenience functions to pull survey results straight into R using the Qualtrics API. See < https://api.qualtrics.com/> for more information about the Qualtrics API. This package is community-maintained and is not officially supported by Qualtrics.
This project contains an R package to interact with the Qualtrics API. It is currently under development. I will add more functionality later.
Note that your institution must support API access and that it must be enabled for your account. Whoever manages your Qualtrics account can help you with this. Please refer to the Qualtrics documentation on how to find your API token.
To install this package, execute the following in R:
Or, if you want to install the latest development version, run:
This package depends on
XML. All dependencies will be installed when you install
Periodically check this repository for updates and execute
devtools::install_github("JasperHG90/qualtRics") to update.
Currently, the package contains three functions. It supports fetching a list of courses and their IDs from qualtrics, as well as downloading and reading a survey export.
Note that, while requests will work without a root url for the
getSurveys function, it is desirable that you supply it. Supplying the correct url will reduce the number of errors you'll experience. The
getSurvey function requires you to pass this root url. Please refer to the official documentation to find out your institution-specific root url.
Note that you can only export surveys that you own, or to which you have been given explicit administration rights.
Load the package:
Register your Qualtrics API key. You need to do this only once per R session:
registerApiKey(API.TOKEN = "<yourapitoken>")
Get a data frame of surveys:
surveys <- getSurveys(root_url="") # URL is for my own institution
Export a survey and load it into R:
mysurvey <- getSurvey(surveyID = surveys$id, root_url = "", verbose = TRUE)
You can request a CSV, JSON or XML file:
mysurvey <- getSurvey(surveyID = surveys$id, format="csv", root_url = "", verbose = TRUE) # CSVmysurvey <- getSurvey(surveyID = surveys$id, format="json", root_url = "", verbose = TRUE) # JSONmysurvey <- getSurvey(surveyID = surveys$id, format="xml", root_url = "", verbose = TRUE) # XML
You may also store the results in a filepath of your choosing:
mysurvey <- getSurvey(surveyID = surveys$id, format="csv", save_dir = "/users/jasper/desktop/", root_url = "", verbose = TRUE)
For specific information about the Qualtrics API, you can refer to the official documentation.
Should you encounter any bugs or issues, please report them here
If you have a request (like adding a new argument), please leave it here
XMLare added to 'Suggests' in DESCRIPTION.
constructHeader()is now deprecated and should no longer be used. Instead, users need to call
registerApiKey()which saves the user's API key and header information in the