# \donttest{
if (requireNamespace("haven", quietly = TRUE)) {
# Roundtrip: write to a temporary .dta, read back
tmp <- tempfile(fileext = ".dta")
write_stata(survey_data, tmp)
data <- read_stata(tmp)
# Stata 13 compatibility
tmp13 <- tempfile(fileext = ".dta")
write_stata(survey_data, tmp13, version = 13)
unlink(c(tmp, tmp13))
}
# }
Run the code above in your browser using DataLab