Learn R Programming

iNZightTools (version 2.0.1)

rename_vars: Rename column names

Description

Rename columns of a dataset with desired names

Usage

rename_vars(data, tobe_asis)

Value

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

Arguments

data

a dataframe with columns to rename

tobe_asis

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

Author

Zhaoming Su

See Also

code

Examples

Run this code
renamed <- rename_vars(iris, list(
    sepal_length = "Sepal.Length",
    sepal_width = "Sepal.Width",
    petal_length = "Petal.Length",
    petal_width = "Petal.Width"
))
cat(code(renamed))
head(renamed)

Run the code above in your browser using DataLab