rename_with_labels function

Rename every column of a dataframe with its label

Rename every column of a dataframe with its label

Source

https://stackoverflow.com/q/75848408/3888000

rename_with_labels(df, except = NULL)

Arguments

  • df: a data.frame
  • except: <tidy-select> columns that should not be renamed.

Returns

A dataframe which names are copied from the label attribute

Examples

rename_with_labels(mtcars2[,1:5], except=5) %>% names() rename_with_labels(iris2, except=Sepal.Length) %>% names() rename_with_labels(iris2, except=starts_with("Pet")) %>% names()

Author(s)

Dan Chaltiel