This function makes it easy to get the variable labels from either an individual vector or a data frame. NOTE: it is not possible to set or modify the variable labels with this function.
Arguments
- x
A vector object, the name of a column in a
data.frame
, or an an actualdata.frame
object.- data
A
data.frame
ortibble
object. This should only be specified whenx
is only the name of a column in adata.frame
.- unlist
Logical. If
TRUE
, the default, returns a named vector. IfFALSE
, returns a list. This only works whenx
is adata.frame