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.

Status

Maintained, but not under development. Use the qualtrics package, which combines qsurvey, qualtRics, and qualtricsR.

Installation

Install the latest version from GitHub:

# install.packages("devtools")
devtools::install_github("jamesdunham/qsurvey")

Usage

library(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 key_from_file().

Qualtrics assigns each survey a unique id. You can search by survey name for an id using find_id(). Use surveys() to see the ids and other metadata for all surveys, in a table similar to the Qualtrics Control Panel overview.

Survey responses

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 names_to_ids() and drop_meta().

Survey design

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?

See also choices(), blocks(), and response_counts().

Visualization

Visualize a survey flow with plot_flow(). Or for interactive review of a survey’s flow and content in a Shiny app, use render_flow().

plot_flow(design_object = d)

See also edges() and nodes().