Skip to contents

Generate Qualtrics Survey

Generating a Qualtrics survey requires a path to a setup file that contains the question text and IDs. This file must have an id column and each entry in this column needs to be unique. In the Qualtrics file, the number of questions generated will be equal to the number of rows in the setup file. The question column will be used as the question text in the Qualtrics survey and is optional.

setup_file <- system.file("extdata", "sample_setup_file.csv", package = "ThinkingGrid")
setup_data <- read.csv(setup_file)

knitr::kable(setup_data, caption = "Sample Setup File")
Sample Setup File
id question
TG1 this question 1
TG2 this question 2
TG3 this question 3
TG4 this question 4
TG5 this question 5

The generate_survey function can be used to generate the Qualtrics survey. The output will be a .qsf file that can be imported into Qualtrics. The question_text argument determines whether the question text from the setup file is included in the survey. If set to TRUE, the question text will be included; if set to FALSE, “Insert text here” will be used as a placeholder for the question text.

generate_survey(
  survey_setup_file = setup_file, # path to the setup file
  output_file_name = "my_thinking_grid_survey", # custom name for the output file
  question_text = TRUE # whether to include question text in the survey
)

When you run this code interactively, it will generate a file named my_thinking_grid_survey-0.qsf in your current working directory.

The above code will generate a file named my_thinking_grid_survey-0.qsf in the current working directory. This file can be imported into Qualtrics to create the survey. The filename follows the pattern {output_file_name}-{partition_number}.qsf, where the partition number starts from 0. Once imported, you can further customize the survey in Qualtrics as needed.

Read Qualtrics Survey Data

Once data collection is complete, download the survey data from Qualtrics in CSV format. The read_survey_data function can be used to read this data into R. The function requires the path to the setup file and the path to the downloaded CSV file from Qualtrics. The function will return a data frame with the survey responses.

# Path to the downloaded Qualtrics survey data CSV file
qualtrics_data_file <- system.file("extdata", "sample_qualtrics_output.csv", package = "ThinkingGrid")

survey_data <- read_qualtrics_data(
  data_file = qualtrics_data_file, # path to the Qualtrics data file
  setup_file = setup_file # path to the setup file
)

read_qualtrics_data returns a dataframe. uid is the unique identifier for each row in the Qualtrics output. Deliberate.Constraints and Automatic.Constraints columns correspond to the X and Y axes respectively; they span from one to six. Depths within each quadrant are denoted by Free.Depth, Directed.Depth, AffDir.Depth, and Sticky.Depth. These four columns represent the bottom-left, bottom-right, top-right, and top-left quadrants respectively. Values in these four columns range from zero to five.

knitr::kable(survey_data, caption = "Survey Data Read from Qualtrics")
Survey Data Read from Qualtrics
uid Probe.Identifier Deliberate.Constraints Automatic.Constraints Free.Depth Directed.Depth AffDir.Depth Sticky.Depth
1 TG1 3 6 0 0 0 3
1 TG2 6 1 0 5 0 0
1 TG3 4 3 0 1 0 0
1 TG4 2 3 2 0 0 0
1 TG5 6 6 0 0 5 0
2 TG1 4 2 0 2 0 0
2 TG2 1 5 0 0 0 4
2 TG3 2 3 2 0 0 0
2 TG4 5 6 0 0 4 0
2 TG5 6 1 0 5 0 0