Helper to make a placeholder for a label-value pair.

lbl(...)

Arguments

...

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.

Value

A label_placeholder object, useful in functions like lbl_add

See also

Examples

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