lbl_clean: Clean unused labels

Description Usage Arguments Value See Also Examples

View source: R/lbl_helpers.r

Description

Remove labels that do not appear in the data.

Usage

1

Arguments

x

A labelled vector

Value

A haven::labelled vector

See Also

Other lbl_helpers: lbl_add(), lbl_collapse(), lbl_define(), lbl_na_if(), lbl_relabel(), lbl(), zap_ipums_attributes()

Examples

1
2
3
4
5
6
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)

ipumsr documentation built on July 22, 2020, 1:06 a.m.