ll_to_character {zmisc} | R Documentation |
Get the character representation of a labelled variable
Description
Returns a character representation of a labelled variable, using the value labels to look up the label for a given value.
The default behavior of this function is similar to
labelled::to_character()
. The options, however, are slightly different.
Most importantly, instead of specifying NA
handling using parameters, the
function relies on the default
parameter to determine what happens for
unlabelled variables, allowing users to specify including the original values
of x
instead of the labels, returning NA
, or returning a specific string
value. Also, the default behavior is to drop any variable label attribute, in
line with the default as.character()
method.
Usage
ll_to_character(x, default = x, preserve_var_label = FALSE)
Arguments
x |
A labelled variable |
default |
Vector providing a default label for any values not found in
the |
preserve_var_label |
Should any |
See Also
Other labelled light:
ll_assert_labelled()
,
ll_labelled()
,
ll_val_labels()
,
ll_var_label()
,
threadbare()