The qualtrics R package provides functions to interact with the Qualtrics online survey tool. It requires that your account have API access. The latest development version can be installed from Github with the devtools package.
> require(devtools)
> install_github('qualtrics', 'ericpgreen')
I forked Jason Bryer's qualtrics repo and modified the core functions to use Version 2.3 of the Qualtrics API.
The first step is to run the auth() function which takes the arguments useremail, brand, and token. If you do not access Qualtrics through a brand (e.g., duke), then leave this blank. You'll need an API token. To get one, login to your account, go to account details, and generate a token.
After you create an auth object, pass it to getSurveyResults() along with your surveyid. You can get a list of survey IDs on your Qualtrics account page. Or just run getSurveys() with your auth object.
My initial motivation for working on this package was to make it easier to program Qualtrics surveys. The most common approach is to use the web interface to create each item. This becomes tedious, however, when you have more than 20 items.
Fortunately, Qualtrics allows bulk uploading of items via a .txt file. Rather than typing this file directly, however, I wanted to specify survey items in a spreadsheet and export the spreadsheet to a format Qualtrics would accept.
Edit the provided template in the doc directory, save it somewhere, and then use the importTemplate() function to import the contents to R as a list. The writeQtxt() function then exports the contents as a .txt file that you can upload to Qualtrics.
The template.xlsx file is not fool-proof. You should read the Qualtrics Advanced Formatting page to get a better understanding of what the template is trying to do.
Basically:
- Blocks are optional. If you want to put items in a block, give the first item in the block (only) a
blockname. To end a block, selectendblockfor the last item. - Pick a
questiontype. Qualtrics does not provide codes for all possible question types. As more codes are released, I will add them to thequestiontypemenu in!menu. questionidis optional.questiontextis where you type your actual item.choicetypecan be "[[Choices]]" or "[[AdvancedChoices]]". "[[AdvancedChoices]]" is not currently implemented, however.- Adding response options is a multi-step process. First, go to the
!choicessheet and create response items. Give items in a set the samelistname. Add thislistnametochoicelistin!menu. Then select thislistnamefrom the drop-down menu in the!surveyworksheet. pagebreakis optional.
- Send new survey to Qualtrics via API
- Update panels functions