rename: Rename data frame columns.

Description Usage Arguments Value Examples

View source: R/rename.R

Description

The data frame columns are renamed according to a correspondance table.
The correspondance table data_remane must at least contains tow columns : column for the old column names and rename for the new column names.

Usage

1
rename(data, data_rename, clean_colnames = TRUE, drop = TRUE)

Arguments

data

A data frame.

data_rename

A correspondance table between old and new column names.

clean_colnames

If TRUE then input data column names are snake_case normalised before renamed according to data_rename.

drop

If TRUE then all the columns not present in data_rename are removed.

Value

A renamed data frame.

Examples

1
2
data <- dplyr::tibble(var1 = "a", old = "b")
patchr::rename(data, dplyr::tibble(column = "old", rename = "new"), drop = FALSE)

stephLH/patchr documentation built on May 14, 2020, 5:57 a.m.