Write responses to SPSS or Stata with the labels attached
Source:R/demo_library.R
sframe_export_labelled.RdA plain CSV carries codes. dm_1 arrives in SPSS as a column of integers
with no variable label and no value labels, and the reader has to
reconstruct all of it from the questionnaire. This attaches both from the
instrument: the variable label is the item's label, and the value labels
come from the item's choice set, which stores its values and labels
side by side.
Arguments
- data
A response data frame, as returned by
read_responses().- instrument
The
sframethe responses were collected with.- path
Output file. An
.savis written for SPSS, a.dtafor Stata, chosen from the extension.
Examples
# \donttest{
demo <- sframe_demo("two_group")
out <- file.path(tempdir(), "two_group.sav")
if (requireNamespace("haven", quietly = TRUE)) {
sframe_export_labelled(demo$responses, demo$instrument, out)
}
# }