Get Label Attributes of Variables in a data.frame
col_labels.Rd
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)
Source
This function was taken 1-1 from formatters package, to reduce the complexity of the dependency tree.
Arguments
- x
a
data.frame
object- fill
boolean in case the
label
attribute does not exist ifTRUE
the variable names is returned, otherwiseNA
See also
col_relabel()
col_labels<-
Examples
x <- iris
col_labels(x)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> NA NA NA NA NA
col_labels(x) <- paste("label for", names(iris))
col_labels(x)
#> Sepal.Length Sepal.Width Petal.Length
#> "label for Sepal.Length" "label for Sepal.Width" "label for Petal.Length"
#> Petal.Width Species
#> "label for Petal.Width" "label for Species"