Rename every column of a dataframe with its label
rename_with_labels(df, except = NULL)https://stackoverflow.com/q/75848408/3888000
a data.frame
<tidy-select> columns that should not be renamed.
A dataframe which names are copied from the label attribute
rename_with_labels(mtcars2[,1:5], except=5) %>% names()
#> [1] "Model" "Miles/(US) gallon" "Number of cylinders"
#> [4] "Displacement (cu.in.)" "hp"
rename_with_labels(iris2, except=Sepal.Length) %>% names()
#> [1] "Sepal.Length" "Width of Sepal" "Length of Petal" "Width of Petal"
#> [5] "Specie"
rename_with_labels(iris2, except=starts_with("Pet")) %>% names()
#> [1] "Length of Sepal" "Width of Sepal" "Petal.Length" "Petal.Width"
#> [5] "Specie"