Learn R Programming

sjPlot (version 1.7)

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 most of this package's functions, in order to automatically set values or legend labels.

Usage

set_val_labels(x, labels)

Arguments

Value

"x" with attached value labels.

See Also

Examples

Run this code
dummy <- sample(1:4, 40, replace=TRUE)
sjp.frq(dummy)

dummy <- set_val_labels(dummy, c("very low", "low", "mid", "hi"))
sjp.frq(dummy)

Run the code above in your browser using DataLab