Check out example codes for "r - change column name". It will help you in understanding the concepts better.

Code Example 1

R> X <- data.frame(bad=1:3, worse=rnorm(3))
R> X
  bad     worse
1   1 -2.440467
2   2  1.320113
3   3 -0.306639
R> colnames(X) <- c("good", "better")
R> X
  good    better
1    1 -2.440467
2    2  1.320113
3    3 -0.306639

Code Example 2

colnames(df)[colnames(df) == "name"] <- "new_name"

Code Example 3

names(df)[1] <- paste("newName")

Code Example 4

df <- rename(df, new_name = old_name) #For renaming dataframe column
 
tbl <- rename(tbl, new_name = old_name) #For renaming tibble column
 
tbl <- tbl %>% rename(new_name = old_name) #For renaming tibble column using dplyrpipe 
                                           #operator

Code Example 5

R> colnames(X)[2] <- "superduper"

Learn ReactJs, React Native from akashmittal.com