Learn R Programming

crosstable (version 0.8.0)

rename_with_labels: Rename every column of a dataframe with its label

Description

Rename every column of a dataframe with its label

Usage

rename_with_labels(df, except = NULL)

Value

A dataframe which names are copied from the label attribute

Arguments

df

a data.frame

except

<tidy-select> columns that should not be renamed.

Author

Dan Chaltiel

Examples

Run this code
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()

Run the code above in your browser using DataLab