Remove labels that do not appear in the data.

lbl_clean(x)

Arguments

x

A labelled vector

Value

A haven::labeled vector

See also

Examples

x <- haven::labelled( c(1, 2, 3, 1, 2, 3, 1, 2, 3), c(Q1 = 1, Q2 = 2, Q3 = 3, Q4= 4) ) lbl_clean(x)
#> <Labelled double> #> [1] 1 2 3 1 2 3 1 2 3 #> #> Labels: #> value label #> 1 Q1 #> 2 Q2 #> 3 Q3