I am writing a wrapper to ggplot to produce multiple graphs based on various datasets. As I am passing the column names to the function, I need to rename the column names so tha
require(plyr) df <- data.frame(col2=1:3,col1=3:5,col3=6:8) df <- rename(df, c("col1"="new_col1", "col2"="new_col2", "col3"="new_col3")) df
And you can be creative in making that second argument to rename so that it is not so manual.
rename