Rename the column name in R using Dplyr

Rename the column name in R using Dplyr. Dplyr package in R is provided with rename() function which re names the column name or column variable.

We will be using mtcars data to depict the re name of column variable.

 

Rename the column name in R using Dplyr:

Rename the column name using rename function in dplyr.

library(dplyr)
mydata <- mtcars

# Rename the column name of the dataframe
Mydata1 = rename(mydata, displacement=disp, cylinder=cyl)
Mydata1

Rename the column name disp with displacement and cyl with cylinder

Rename the column name in R using Dplyr

 

Rename the column name in R using Dplyr                                                                                                                Rename the column name in R using Dplyr