lbl | R Documentation |
Define a new label/value pair. For use in functions like lbl_relabel()
and lbl_add()
.
lbl(...)
... |
Either one or two arguments specifying the label ( If arguments are named, they must be named If a single unnamed value is passed, it is used as the |
Several lbl_*()
functions include arguments that can be passed a function
of .val
and/or .lbl
. These refer to the existing values and
labels in the input vector, respectively.
Use .val
to refer to the values in the vector's value labels.
Use .lbl
to refer to the label names in the vector's value labels.
Note that not all lbl_*()
functions support both of these arguments.
A label_placeholder
object
Other lbl_helpers:
lbl_add()
,
lbl_clean()
,
lbl_define()
,
lbl_na_if()
,
lbl_relabel()
,
zap_ipums_attributes()
# Label placeholder with no associated value
lbl("New label")
# Label placeholder with a value/label pair
lbl(10, "New label")
# Use placeholders as inputs to other label handlers
x <- haven::labelled(
c(100, 200, 105, 990, 999, 230),
c(`Unknown` = 990, NIU = 999)
)
x <- lbl_add(
x,
lbl(100, "$100"),
lbl(105, "$105"),
lbl(200, "$200"),
lbl(230, "$230")
)
lbl_relabel(x, lbl(9999, "Missing") ~ .val > 900)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.