rename a column in dataframe R code example
Example 1: r change column name in dataframe
df <- df %>%
rename(newName1 = oldName1 ,
newName2 = oldName2)
Example 2: r rename column based on variable
rename(df, !!metric:=value)
df <- df %>%
rename(newName1 = oldName1 ,
newName2 = oldName2)
rename(df, !!metric:=value)