[R] ordering a matrix by multiple columns

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Mar 18 19:29:29 CET 2002

Michael Dondrup wrote:
> Dear all,
> is there an easy way to sort or get the order of a matrix or data.frame
> by multiple rows
> (like ODER BY in SQL), that means if some values in the first column are
> equal, then sort them (or 'order') by the second etc.?

What about looking in the help files? My first idea would be to take a
look at ?sort and ?order, two words you already mentioned in your
querstion. And I'd bet you'll get the answer.

Uwe Ligges
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list