README.md

qualtdict

License: MIT

Project Status: Active – The project has reached a stable, usable
state and is being actively
developed. check-standard test-coverage Codecov test
coverage

Qualtrics is an online survey and data collection software platform. The qualtdict R package builds on the qualtRics R package which implements the retrieval of survey data using the Qualtrics API and aims to reduce the pre-processing steps needed in analyzing such surveys. The current package makes more comprehensive use of the survey metadata and generates a variable dictionary including most of the information essential for data processing and analysis. It also uses a modified version of the RAKE algorithm by Rose. et al. implemented in the package slowraker to generate meaningful names for all variables in the survey, as well as adding a comprehensive set of metadata attributes that uniquely identifies each variable.

Installation

This package can be installed with the remotes package.

install.packages("remotes")
remotes::install_github("lyh970817/qultdict")

Example

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.

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) in the dictionary. 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 might want to check for potential mistakes in the survey with dict_validate.

dict_validate(mydict)

And use the dictionary to download sjlabelled survey data.

survey_dat <- get_survey_data(mydict,
  unanswer_recode = -77,
  unanswer_recode_multi = 0
)


lyh970817/qualtdict documentation built on April 8, 2023, 9:26 p.m.