-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read_spss and write_spss: missing labels for strings #409
Comments
Can you please confirm that I've captured the problem in the following reprex? library(haven)
path <- tempfile()
df1 <- tibble::tibble(
x = labelled_spss(c("1", "99"), na_values = "99", c(one = "1"))
)
write_sav(df1, path)
df2 <- read_sav(path, user_na = TRUE)
attr(df1$x, "na_values")
#> [1] "99"
attr(df2$x, "na_values")
#> NULL Created on 2019-01-24 by the reprex package (v0.2.1.9000) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Try WizardMac/ReadStat@963b6eb (dev branch) |
@evanmiller does |
@hadley Actually it looks like a new-ish record type in the SAV file format: |
Note to self: WIP in local missing-string branch. |
Okay the new record type should work in ReadStat master. |
When importing string variables via read_spss missing labels (and sometimes also value labels) seem to behave strangely depending on the width of the variables (at least in educational large scale assessments missing and value labels for string variables are not that uncommon). I used the current GitHub version of haven.
test1.zip
Importing results in the following attributes on variable level:
Created on 2018-10-01 by the reprex package (v0.2.1)
When writing to sav missing labels for string variables are also dropped:
Created on 2018-10-01 by the reprex package (v0.2.1)
And the spss variable view looks like this:
Is there any way to import missing and value labels consistently from sav files to R?
Thank You!
The text was updated successfully, but these errors were encountered: