This function sets variable labels as column names, to use "labelled data" also for those functions that cannot cope with labelled data by default.
Value
x with variable labels as column names. For variables without
variable labels, the column name is left unchanged.
Examples
data(iris)
iris <- var_labels(
iris,
Petal.Length = "Petal length (cm)",
Petal.Width = "Petal width (cm)"
)
colnames(iris)
#> [1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species"
plot(iris)
colnames(label_to_colnames(iris))
#> [1] "Sepal.Length" "Sepal.Width" "Petal length (cm)"
#> [4] "Petal width (cm)" "Species"
plot(label_to_colnames(iris))
