[R] Sorting a data frame when you don't know the columns

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Tue Nov 28 11:45:54 CET 2006


Hi
 
Sorry to ask such a well oiled question, but even with multiple google hits I don't think this has been answered very well.
 
It's all well and good doing a sort of a data frame on multiple columns when you know in advance which columns you want to sort on, but what about when the names of the columns you wish to sort on are in a vector?
 
At the minute I'm messing about with paste() to form a string that works for order() and then calling do.call().  Is this really the best way of doing it?
 
Thanks
Mick



More information about the R-help mailing list