qsurvey is a toolkit for working with the Qualtrics survey platform and its data in R. It focuses on testing and review of surveys before fielding, and analysis of responses afterward.
Install the latest version from GitHub:
# install.packages("devtools") devtools::install_github("jamesdunham/qsurvey")
A Qualtrics API key is needed to communicate with the survey platform. Set the environment variable
QUALTRICS_KEY to your key value. You can do this during R startup (recommended), interactively with
Sys.setenv(), or through
Qualtrics assigns each survey a unique id. You can search by survey name for an id using
surveys() to see the ids and other metadata for all surveys, in a table similar to the Qualtrics Control Panel overview.
Pass a survey's id to
responses() to retrieve responses. This is equivalent to using the "Export Data" tool in the "Data and Analysis" view of the Control Panel and then reading the resulting file into R.
r <- responses(id = "SV_0CGgkDZJaUvxnGl", verbose = FALSE)
For functions that work with survey responses see
To retrieve a survey's design use
design(). This returns a
qualtrics_design object that many other qsurvey functions can operate on.
d <- design(id = "SV_0CGgkDZJaUvxnGl") print(d) #> # A qualtrics_design: #> name Student Feedback #> id SV_0CGgkDZJaUvxnGl #> created 2016-11-24 #> modified 2016-11-24 #> responses 0 (closed) #> questions 26 #> blocks 3
For example, use
questions() to see the text and other attributes of each survey question.
svy_q <- questions(design_object = d) svy_q[1:2, ] #> question_order question_id export_name #> 1: 1 QID132224516 Q1 #> 2: 2 QID132224536 Q3 #> question_text #> 1: Overall, how satisfied or dissatisfied were you with this class? #> 2: How interesting was this class?
Visualize a survey flow with
plot_flow(). Or for interactive review of a survey's flow and content in a Shiny app, use
plot_flow(design_object = d) #> PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.
qualtRics is another R package for working with the Qualtrics API that began around the same time as qsurvey.
qualtricsR focuses on survey creation.
QualtricsTools generates reports from Qualtrics data via Shiny.