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
hmm, this might be way to complicated, but the first that come into my mind:
lookup <- data.frame(search = c(col3_search,col2_search,col1_search), replace = c(col3_replace,col2_replace,col1_replace)) colnames(df) <- lookup$replace[match(lookup$search, colnames(df))]