License: MIT
Qualtrics is an online survey and data collection software platform. The qualtdict package builds on the qualtRics R package which implements the retrieval of survey data using the Qualtrics API. The current package makes more comprehensive use of the survey metadata and generates a variable dictionary inlucding most of the information essential for data processing and analysis. It also uses a modified version of the RAKE (Rapid Automatic Keyword Extraction; https://www.osti.gov/biblio/978967) algorithm implemented in the package slowraker to generate meaningful names for variables in the survey, as well as using the sjlabelled package to add a comprehensive set of metadata attributes that uniquely identifies each variable.
This package is in an early stage of development and can be installed with the devtools package.
Note that the package currently depends on my own fork of the qualtRics package (the pull requests of which I have submitted).
install.packages("devtools")
devtools::install_github("lyh970817/qualtRics", ref = "qualtdict")
devtools::install_github("lyh970817/qultdict")
You need to first register your Qualtrics credentials with the function
qualtrics_api_credentials
exported from the package
qualtRics.
library(qualtdict)
qualtrics_api_credentials(api_key = "<YOUR-QUALTRICS_API_KEY>",
base_url = "<YOUR-QUALTRICS_BASE_URL>",
install = TRUE)
You can then generate a variable dictionary with a Qualtrics survey ID.
mydict <- dict_generate("SV_4YyAHbAxpdbzacl", var_name = "question_name")
You may wish to generate meaningful variable names (if you don’t already have them in the survey) from various text elements (question text, item and label) in the survey.
If doing so, preferably you would also want to define a function that extracts block prefixes from block names.
# Define a block prefix extraction function
block_pattern <- function(x) {
substring(x, 1, 3)
}
mydict <- dict_generate("SV_4YyAHbAxpdbzacl",
var_name = "easy_name",
block_pattern = block_pattern,
block_sep = "."
)
You could validate (check for potential mistakes in) the dictionary.
dict_validate(mydict)
And download labelled survey data with the dictionary.
survey_dat <- get_survey_data(mydict,
unanswer_recode = -77,
unanswer_recode_multi = 0
)