Learn R Programming

rtables (version 0.4.0)

var_labels: Get Label Attributes of Variables in a data.frame

Description

Variable labels can be stored as a label attribute for each variable. This functions returns a named character vector with the variable labels (empty sting if not specified)

Usage

var_labels(x, fill = FALSE)

Arguments

x

a data.frame object

fill

boolean in case the label attribute does not exist if TRUE the variable names is returned, otherwise NA

Value

a named character vector with the variable labels, the names correspond to the variable names

Examples

Run this code
# NOT RUN {
x <- iris
var_labels(x)
var_labels(x) <- paste("label for", names(iris))
var_labels(x)
# }

Run the code above in your browser using DataLab