r change column names code example
Example 1: r change column name in dataframe
df <- df %>%
rename(newName1 = oldName1 ,
newName2 = oldName2)
Example 2: r - change column name
colnames(df)[colnames(df) == "name"] <- "new_name"
Example 3: r dataframe change column name
names(df)[1] <- paste("newName")
Example 4: r set dataframe column names
R> colnames(X)[2] <- "superduper"