get_label {labelVector} | R Documentation |
Extract Label Attribute From a Labelled Vector
Description
Retrieve the label attribute of a labelled vector. If the vector has no label, the vector name is returned as a string.
Usage
get_label(x, ...)
## Default S3 method:
get_label(x, ...)
## S3 method for class 'data.frame'
get_label(x, vars = NULL, ..., return_vector = TRUE)
Arguments
x |
An atomic vector. |
... |
Arguments to pass to other methods. |
vars |
A character vector of variable names in |
return_vector |
|
See Also
Examples
x <- 1:10
x <- set_label(x, "Integers")
get_label(x)
y <- letters
attr(y, "label") # NULL
get_label(y) # "y"
# Set labels for variables in a data frame
mtcars2 <-
set_label(mtcars,
am = "Automatic / Manual",
mpg = "Miles per Gallon",
gear = "Number of gears")
get_label(mtcars2)
[Package labelVector version 0.1.2 Index]