Helper to make a placeholder for a label-value pair.
lbl(...)
... | Either one or two arguments, possibly named .val and .lbl. If a single unnamed value, represents the label, if 2 unnamed values, the first is the value and the second is the label. |
---|
A label_placeholder
object, useful in functions like lbl_add
Other lbl_helpers:
lbl_add()
,
lbl_clean()
,
lbl_collapse()
,
lbl_define()
,
lbl_na_if()
,
lbl_relabel()
,
zap_ipums_attributes()
x <- haven::labelled( c(100, 200, 105, 990, 999, 230), c(`Unknown` = 990, NIU = 999) ) lbl_add(x, lbl(100, "$100"), lbl(105, "$105"), lbl(200, "$200"), lbl(230, "$230")) #> <labelled<double>[6]> #> [1] 100 200 105 990 999 230 #> #> Labels: #> value label #> 100 $100 #> 105 $105 #> 200 $200 #> 230 $230 #> 990 Unknown #> 999 NIU