powered by
data.frame
Variable labels can be stored as the label attribute for each variable. This functions sets all non-missing (non-NA) variable labels in a data.frame.
label
NA
var_labels(x) <- value
x with modified variable labels.
x
(data.frame) a data frame object.
(character) a vector of new variable labels. If any values are NA, the label for that variable is removed.
character
x <- iris var_labels(x) var_labels(x) <- paste("label for", names(iris)) var_labels(x) if (interactive()) { View(x) # in RStudio data viewer labels are displayed }
Run the code above in your browser using DataLab