Reproducibility - Preserving Survey Data

Authors

Laurel Krovetz

Lars Vilhuber

Published

January 1, 2026

Here we will demonstrate how to preserve raw survey data and also how to handle confidential data. We will do so with data from a survey that you all will provide responses to. Some of the questions are meant to elicit “confidential” information from you as responses. You should not give your actual confidential information in response to these questions. We will use these questions as way to teach how to preserve data when some data are confidential.

These are the results from all responses ever submitted. This might differ from the presentation!

gender Frequency Percent
Male 5 50
Female 5 50
education Frequency Percent
Secondary or less 1 10
Master’s degree 5 50
Professional or doctoral degree 4 40

Age

Statistic Value
Count 9.00
Mean 34.11
Median 30.00
Min 25.00
Max 62.00
Std. Dev. 11.94

Number of tabs open

Statistic Value
Count 10.00
Mean 15.80
Median 16.00
Min 2.00
Max 27.00
Std. Dev. 9.19

For more information and steps on how to start creating a survey in Qualtrics, how to process and clean the data to remove confidential data, see this presentation.

# Now save the data to a local file
if (nrow(data) > 0) {
  write_csv(data, here::here("data", "tutorial-survey.csv"))
  saveRDS(data, here::here("data", "tutorial-survey.rds"))
} else {
  # message("No data to save.")
}