Convert declared labelled objects to haven labelled objects
Details
This is a function that reverses the process of as.declared()
, making
a round trip between declared
and haven_labelled_spss
classes.
Examples
x <- declared(
c(1:5, -1),
labels = c(Good = 1, Bad = 5, DK = -1),
na_values = -1
)
x
#> <declared<numeric>[6]>
#> [1] 1 2 3 4 5 NA(-1)
#> Missing values: -1
#>
#> Labels:
#> value label
#> 1 Good
#> 5 Bad
#> -1 DK
as.haven(x)
#> <labelled_spss<double>[6]>
#> [1] 1 2 3 4 5 -1
#> Missing values: -1
#>
#> Labels:
#> value label
#> 1 Good
#> 5 Bad
#> -1 DK