I use
df <- read_sav("data/file.sav", user_na = FALSE)
But the data does not look like expected
col1 col2
1 Onestreet
2 Twostreet
NA
4
5
How come rows 3-5 not become NA in col2?
I use
df <- read_sav("data/file.sav", user_na = FALSE)
But the data does not look like expected
col1 col2
1 Onestreet
2 Twostreet
NA
4
5
How come rows 3-5 not become NA in col2?
To convert the empty strings to missing you can do:
library(dplyr)
df %>%
mutate(col2 = if_else(col2 == '', NA_character_, col2))