switch_labels: Switch 'labels' and column names in a data frame

Description Usage Arguments Details Value

Description

Switch 'labels' and column names in a data frame

Usage

1
switch_labels(df, remove_prefix = 0)

Arguments

df

the data.frame (or tibble) to process

remove_prefix

number of characters to skip from label at the beginning (4 removes standard (en) prefix)

Details

If a column does not have a 'label' attribute, it is skipped. If labels are not unique, subsequent columns are ignored and a warning is issued.

Value

df where each column is renamed to its attribute 'label'; previous column name is stored as attribute 'label'.


kkmann/CENTERTBI documentation built on May 23, 2019, 8:51 a.m.