SyntaxFix
Write A Post
Hire A Developer
Questions
Building on @user3114046's answer:
x <- data.frame(q=1,w=2,e=3) x # q w e #1 1 2 3 names(x)[match(oldnames,names(x))] <- newnames x # A w B #1 1 2 3
This won't be reliant on a specific ordering of columns in the x dataset.
x