-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
125 lines (86 loc) · 3.68 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
output: github_document
always_allow_html: yes
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# qsurvey
[![Build Status](https://travis-ci.org/jamesdunham/qsurvey.svg?branch=master)](https://travis-ci.org/jamesdunham/qsurvey)
[![CRAN Status Badge](https://www.r-pkg.org/badges/version/qsurvey)](https://cran.r-project.org/package=qsurvey)
[![codecov](https://codecov.io/github/jamesdunham/qsurvey/branch/master/graphs/badge.svg)](https://codecov.io/github/jamesdunham/qsurvey)
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](https://github.com/cloudyr/qualtrics) package, which combines
qsurvey, [qualtRics](https://github.com/JasperHG90/qualtRics), and
[qualtricsR](https://github.com/saberry/qualtricsR).
## Installation
Install the latest version from GitHub:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("jamesdunham/qsurvey")
```
## Usage
```{r}
library(qsurvey)
```
A [Qualtrics API
key](https://www.qualtrics.com/support/integrations/api-integration/api-integration)
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](https://www.rdocumentation.org/packages/base/versions/3.3.1/topics/Startup)
(recommended), interactively with
[`Sys.setenv()`](https://www.rdocumentation.org/packages/base/versions/3.3.1/topics/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}
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.
```{r}
d <- design(id = "SV_0CGgkDZJaUvxnGl")
print(d)
```
For example, use `questions()` to see the text and other attributes of each
survey question.
```{r}
svy_q <- questions(design_object = d)
svy_q[1:2, ]
```
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()`.
```{r}
plot_flow(design_object = d)
```
See also `edges()` and `nodes()`.
## Related
* [qualtRics](https://github.com/JasperHG90/qualtRics) is another R package for
working with the Qualtrics API that began around the same time as qsurvey.
* [qualtricsR](https://github.com/saberry/qualtricsR) focuses on survey creation.
* I'm aware of two R packages for earlier versions of the Qualtrics API. [Jason
Bryer](https://github.com/jbryer/qualtrics) wrote one in 2012. [Eric
Green](https://github.com/ericpgreen/qualtrics) forked and revised it for v2.3
of the Qualtrics API, most recently in 2014.
* [QualtricsTools](https://github.com/ctesta01/QualtricsTools) generates reports
from Qualtrics data via Shiny.
* Python: [PyQualtrics](https://github.com/Baguage/pyqualtrics);
[SurveyHelper](https://github.com/cwade/surveyhelper).