Hello,
I have a dataframe with 9 columns, and I would like to sort (order) the
right-most eight of them alphabetiaclly, i.e.:
ID1 ID2 F G A B C E D
would become
ID1 ID2 A B C D E F G
Right now, I'm using this code:
attach(data)
data<-data.frame(ID1,ID2,data[,sort(colnames(data)[3:9])])
detach(data)
but that's not very elegant. Ideally I could specify which columns to
sort and which to leave "as is" (but my attempts to do so have failed).
Thank you,
Mark
______________________________________________
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.