I want to rename some random columns of a large data frame and I want to use the current column names, not the indexes. Column indexes might change if I add
You can use the str_replace function of the stringr package:
str_replace
names(mydf) <- str_replace(names(mydf), "MyName.1", "MyNewName")