A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/tidyverse/haven/issues/596 below:

write_sav() fails to set missing values · Issue #596 · tidyverse/haven · GitHub

Information about missing values is lost, roundtrip reprex below

library(haven)
library(tibble)
test <- tibble(A = labelled_spss(1:10, c(Good = 1, Bad = 8, DK = 9, NR = 10), na_values = c(9, 10)))
test$A
# <labelled_spss<integer>[10]>
#  [1]  1  2  3  4  5  6  7  8  9 10
# Missing values: 9, 10

# Labels:
#  value label
#      1  Good
#      8   Bad
#      9    DK
#     10    NR

write_sav(test, "test.sav")

testback <- read_sav("test.sav")
testback$A
# <labelled<double>[10]>
#  [1]  1  2  3  4  5  6  7  8  9 10

# Labels:
#  value label
#      1  Good
#      8   Bad
#      9    DK
#     10    NR

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4