Returns a character vector of value labels of a specific rfrnds()
column, in the same order as var_vals()
, or of length 0
if var_name
's values are
not restricted to a predefined set or no value labels are defined in the codebook.
Arguments
- var_name
Variable name present in
data_codebook
for which the labels are to be returned. A character scalar.- incl_affixes
Whether or not to add the corresponding
value_label_prefix
andvalue_label_suffix
to the returned labels.
Value
A character vector. Of length 0
if var_name
's values are not restricted to a predefined set or no value labels are defined in the
codebook.
See also
Other referendum metadata functions:
data_codebook
,
prettify_var_names()
,
val_scale()
,
var_name_unnested()
,
var_vals()
Examples
rdb::val_lbls("result",
incl_affixes = FALSE)
#> [1] "approved" "rejected"
rdb::val_lbls("result")
#> [1] "The referendum proposal was approved" "The referendum proposal was rejected"
# Convert the labels to sentence case with trailing dot
rdb::val_lbls("result") |> pal::sentenceify()
#> [1] "The referendum proposal was approved." "The referendum proposal was rejected."