sp

module
v0.0.0-...-c1bc8f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2023 License: MIT

README

SP (survey parser)

sp is a tool for parsing Qualtrics data into a format suitable for R.

Build Status codecov Go Report Card

Getting started

sp takes Qualtrics data and creates both a CSV and R import script.

  1. Install sp with the command go install github.com/fflewddur/sp/cmd/sp (you can download Go here if you don't already have it).

  2. Export your Qualtrics survey as a QSF file (in Qualtrics: Survey → Tools → Import/Export → Export survey).

  3. Export your Qualtrics responses as an XML file (in Qualtrics: Data & Analysis → Export & Import → Export data, select XML; ensure 'Use choice text' is selected; optionally, check the two options to recode seen but unanswered questions/fields).

  4. Rename both the QSF and XML files to have the same base name (e.g., survey.qsf and survey.xml). Both files need to be in the same folder.

  5. Run sp on your survey data with the command sp <PATH_TO_QSF_FILE>. For example, if you saved your QSF and XML files to ~/Downloads with the names survey.qsf and survey.xml, you would run the command sp ~/Downloads/survey.qsf. sp will read the survey structure from the QSF file and participants' responses from the XML file. It will create two files: a CSV containing participants' responses, and an R script for importing the CSV into R. These files will be created in the same folder as the QSF file and share the same base name (e.g., running sp ~/Downloads/survey.qsf will create survey.csv and survey.r in your Downloads folder).

  6. Import the data into R by running import script sp generated. Continuing the above example, we'd start R and run the command source("survey.r", encoding = "utf8"). Qualtrics exports data encoded in UTF-8, but R will default to the value of getOption("encoding") when sourcing survey.r unless you tell it otherwise.

  7. (Optional) You can edit the generated R script as appropriate. By default it will define a type for each CSV column (logical, factor, integer, etc.) and include factor levels. For questions that allow multiple responses, logical columns for each response will be generated.

Building

To build sp, run go build ./cmd/sp from the root of the repository.

To run unit tests, use the command go test -race ./libsp from the root of the repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Directories

Path Synopsis
cmd
sp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL