# \donttest{
if (requireNamespace("haven", quietly = TRUE)) {
# Roundtrip: write to a temporary .sav, read back
tmp <- tempfile(fileext = ".sav")
write_spss(survey_data, tmp)
data <- read_spss(tmp)
# Export with zlib compression (smaller file, requires SPSS v21+)
tmp_z <- tempfile(fileext = ".zsav")
write_spss(survey_data, tmp_z, compress = "zsav")
unlink(c(tmp, tmp_z))
}
# }
Run the code above in your browser using DataLab