labelled_spss {haven} | R Documentation |
This class is only used when user_na = TRUE
in
read_sav()
. It is similar to the labelled
class
but it also models SPSS's user-defined missings, which can be up to
three distinct values, or for numeric vectors a range.
labelled_spss(x, labels, na_values = NULL, na_range = NULL)
x |
A vector to label. Must be either numeric (integer or double) or character. |
labels |
A named vector. The vector should be the same type as
|
na_values |
A vector of values that should also be considered as missing. |
na_range |
A numeric vector of length two giving the (inclusive) extents
of the range. Use |
x1 <- labelled_spss(1:10, c(Good = 1, Bad = 8), na_values = c(9, 10)) is.na(x1) x2 <- labelled_spss(1:10, c(Good = 1, Bad = 8), na_range = c(9, Inf)) is.na(x2)