README.md

cjdata

cjdata is a small package for the first two steps necessary in conjoint analysis: read a CSV file downloaded from Qualtrics and make a long-format data frame. There exist other similarly-purported functions in the existing packages, such as cj_tidy() in the cregg package and read.qualtrics() in the cjoint package. For some researchers, however, these functions may be too "fancy" (or "complicated") for various reasons. They may want to do something much simpler -- just read a CSV file downloaded from Qualtrics and transform wide-format data into long-format data with minimum additional wrangling, which researchers can do outside the function.

Some notes:

Installation

You can install the development version of cjdata from GitHub with:

# install.packages("devtools")
devtools::install_github("yhoriuchi/cjdata")

Example

This is a basic example which reshapes data (wide-form) for conjoint analysis. The original data set is from Campus Diversity: The Hidden Consensus by John Carey, Katie Clayton, and Yusaku Horiuchi (Cambridge University Press, 2020). The complete replication package is available at https://doi.org/10.7910/DVN/KMS5ZY. For more information about the book, see: https://horiuchi.org/diversity/.

library(cjdata)
outcomes <- paste0("Q2.", seq(from = 4, to = 31, by = 3))
cjdata <- reshape_conjoint(exampleData, V1, outcomes)

To read the original Qualtrics data (with two rows being used for information about each column), use another function in this package, read_Qualtrics(). For example,

library(cjdata)
data <- read_Qualtrics("Campus_Diversity_Project__Dartmouth_Faculty_Recruitment.csv")
cjdata <- reshape_conjoint(data, V1, paste0("Q2.", seq(from = 4, to = 31, by = 3))

Note: "Campus_Diversity_Project__Dartmouth_Faculty_Recruitment.csv" is downloadable from the "data-raw" folder of this GitHub respository.



yhoriuchi/cjdata documentation built on July 29, 2022, 8:42 p.m.