Is there a way to swap the order of the first 2 columns in a data frame with 100+ columns?
All the methods online require you to input the order yourself and with 100 columns that's a bit too tedious.
Example solution being
dfrm <- dfrm[c("2", "3", "1", "4")]
However, with my large data frame this solution is impractical. I want to maintain all the columns order except swap the first two so column 2 is in column 1's position since the software I'm using requires column 1 to be sampleID which I have as column 2, which leads to an error.
Thanks