How can I swap the column names at the same time ? > m <- cbind(x=1:3, y=2:4, z=3:5)> m x y z[1,] 1 2 3[2,] 2 3 4[3,] 3 4 5 > m[,c(1,2)] <- m[,c(2,1)]> m x y z[1,] 2 1 3[2,] 3 2 4[3,] 4 3 5 _________________________________________________________________
[[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.