Learn R Programming

rtables (version 0.4.0)

var_labels<-: Set Label Attributes of All Variables in a data.frame

Description

Variable labels can be stored as a label attribute for each variable. This functions sets all non-missing (non-NA) variable labels in a data.frame

Usage

var_labels(x) <- value

Arguments

x

a data.frame object

value

new variable labels, NA removes the variable label

Value

modifies the variable labels of x

Examples

Run this code
# NOT RUN {
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