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, label = NULL)
| x | A vector to label. Must be either numeric (integer or double) or character. |
|---|---|
| labels | A named vector or |
| 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 |
| label | A short, human-readable description of the vector. |
labelled_spss (haven)
#> <Labelled SPSS integer> #> [1] 1 2 3 4 5 6 7 8 9 10 #> Missing values: 9, 10 #> #> Labels: #> value label #> 1 Good #> 8 Badis.na(x1)#> [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE#> <Labelled SPSS integer> #> [1] 1 2 3 4 5 6 7 8 9 10 #> Missing range: [9, Inf] #> #> Labels: #> value label #> 1 Good #> 8 Badis.na(x2)#> [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE