Learn R Programming

iNZightTools (version 1.13.0)

renameVars: Rename column names

Description

Rename column names and returns the result along with tidyverse code used to generate it.

Usage

renameVars(.data, to_be_renamed_list)

Value

original dataframe containing new columns of the renamed columns with tidyverse code attached

Arguments

.data

a dataframe with columns to rename

to_be_renamed_list

a list of the new column names assigned to the old column names ie. list('old column names' = 'new column names')

Author

Owen Jin

See Also

code

Examples

Run this code
renamed <- renameVars(iris,
    to_be_renamed_list = list(Species = "Type", Petal.Width = "P.W"))
cat(code(renamed))
head(renamed)

Run the code above in your browser using DataLab