set_val_labels: Attach value labels to a variable or vector
Description
This function attaches character labels as "value.labels" attribute
to a variable or vector "x", resp. to all variables of a data frame
if "x" is a data.frame. These value labels will be accessed
by functions of the sjPlot package, in order to automatically set values
or legend labels.
Usage
set_val_labels(x, labels)
Arguments
x
a variable (vector) or a data frame where labels should be attached. Replaces former value labels.
labels
a character vector of labels that will be attached to x by setting
the "labels" or "value.labels" attribute. The length of this character vector must equal
the value range of x, i.e. if x ha
Value
x with attached value labels; or with removed label-attribute if
labels = "".