rename_with_labels {crosstable}R Documentation

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)

Arguments

df

a data.frame

except

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

Value

A dataframe which names are copied from the label attribute

Author(s)

Dan Chaltiel

Source

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

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()

[Package crosstable version 0.7.0 Index]