Finish incomplete haven attributes substituting missings with values
Source:R/ds2dd_detailed.R
haven_all_levels.Rd
Finish incomplete haven attributes substituting missings with values
Examples
ds <- structure(c(1, 2, 3, 2, 10, 9),
labels = c(Unknown = 9, Refused = 10),
class = "haven_labelled"
)
labelled::is.labelled(ds)
#> Error in loadNamespace(x): there is no package called ‘labelled’
attributes(ds)
#> $labels
#> Unknown Refused
#> 9 10
#>
#> $class
#> [1] "haven_labelled"
#>
ds |> haven_all_levels()
#> 1 2 3 Unknown Refused
#> 1 2 3 9 10