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)
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 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.
We can learn much more about a survey's questions with the questions()
function.
feedback_q <- questions(feedback) head(feedback_q)
This table gives:
The order in which questions appear (WARNING: possibly misleading depending on survey flow setup)
Unique identifiers as generated by Qualtrics
export_name
, which gives the names a user assigned to questions in the
Qualtrics Control Panel
The respondent-facing question_text
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:
choice_text
gives the respondent-visible text associated with a choice.
choice_description
is (optionally) a different string that you can associate
with a choice (e.g., to make the response data more readable). By default,
it's the same as choice_text
.
choice_recode
is (optionally) a number other than the choice_id
that you
can associate with a choice, for example so that choices are in {-1, 0, 1}
instead of {1, 2, 3}
when exporting the response data. choice_recode
defaults to choice_id
.
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()
.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.