change column name in R dataframe $ code example
Example 1: r change column name in dataframe
df <- df %>%
rename(newName1 = oldName1 ,
newName2 = oldName2)
Example 2: r rename columns
library(plyr)
rename(d, c("beta"="two", "gamma"="three"))
#> alpha two three
#> 1 1 4 7
#> 2 2 5 8
#> 3 3 6 9