Label: Get Variable Label

Description Usage Arguments Author(s) Examples

Description

This function returns character value previously stored in variable's label attribute. If none found, and fallback argument is set to TRUE, the function returns object's name (retrieved by deparse(substitute(x))), otherwise NA is returned with a warning notice.

Usage

1
Label(x, fallback = TRUE, simplify = TRUE)

Arguments

x

an R object to extract labels from.

fallback

a logical indicating if labels should fallback to object name(s). Default is set to TRUE.

simplify

a logical indicating if coerce results to a vector, otherwise, a list is returned. Default is set to TRUE.

Author(s)

Daniel Marcelino, dmarcelino@live.com

Examples

1
2
3
4
5
6
 x <- rnorm(100)
Label(x)             # returns "x"

Label(twins$IQb) <- "IQ biological scores"

Label(twins, FALSE)  # returns NA where no labels are found

SciencesPo documentation built on May 29, 2017, 9:28 p.m.