knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

This vignette demonstrates working with Qualtrics survey designs, which qsurvey formalizes as qualtrics_design objects that represent the configuration of a survey. Before continuing you should have installed qsurvey: see the installation instructions.

library(qsurvey)

Retrieve a survey design

Survey metadata is available from the Qualtrics platform via surveys().

survey_meta <- surveys()
survey_meta[grepl("Feedback|Demographics", name), ]

This Qualtrics account has access to a handful of surveys. We'll pick one for examination in detail. Passing a survey's id to design() retrieves its qualtrics_design object.

(feedback_id <- find_id("Student Feedback"))
feedback <- design(feedback_id)

Printing the design gives us some basic information. Some we already saw when calling surveys(). There are three new numbers giving counts of responses, questions, and blocks.

print(feedback)

Note: a qualtrics_design object is immutable and can become outdated. If after downloading a survey's design you make changes to it in the Qualtrics Control Panel, call design() again to recreate its qualtrics_design object.

Blocks

Blocks of questions are the main organizing element of surveys. The blocks() function shows a survey's blocks.

blocks(feedback)

Each block has a unique block_id. A block_description is the descriptive text (name) given to a block when editing it through the Qualtrics Control Panel. If we wanted more details about these blocks, we could use argument elements=TRUE to see what each block contains.

blocks(feedback, elements = TRUE)

The new columns show the elements in each block: their type (question or page break); unique question identifiers; and the details of block content randomization, if any.

Questions

We can learn much more about a survey's questions with the questions() function.

feedback_q <- questions(feedback)
head(feedback_q)

This table gives:

Choices

We didn't see in the questions() output the response choices that are available to survey-takers. You can access these with the choices() function.

feedback_choices <- choices(feedback)
head(feedback_choices)

Each choice has an identifier choice_id that's unique within questions. In the other columns:

Visualization

A survey flow describes the order in which respondents can encounter the elements of a survey. The "Survey Flow" view in the Qualtrics Control Panel lets you make changes. You can visualize a survey flow in R using plot_flow().

# Not run
# plot_flow(feedback)

plot_flow() shows the survey flow as a directed graph, whose nodes can be flow elements like blocks, branches, and block randomizers. Edges between nodes can be deterministic, conditional, or random. (In this simple survey, all the edges are deterministic.) Conditional edges implement branch logic. Random edges represent outcomes from a block randomizer.

A Shiny app (experimental) that includes a similar visual representation of survey flow is available through render_flow(). For the nodes and edges in tabular format, see edges() and nodes().

Conclusion

Many of the functions in qsurvey operate on qualtrics_design objects. This vignette demonstrated how to retrieve one with design(), and then use blocks(), questions(), and choices() to examine the respondent-facing content of a survey and the configuration of renaming/recoding schemes and survey flow. If you have a question or suggestion, please open a GitHub issue.



jamesdunham/qsurvey documentation built on May 18, 2019, 11:20 a.m.