[R] order a matrix

Christian Hennig chrish at stats.ucl.ac.uk
Mon Nov 5 18:08:08 CET 2007


Dear list,

order(x,y,z) returns a permutation to order x, ties broken by y, remaining 
ties broken by z. (And so on.)

What I'd like to do is
order(X), where X is a matrix (or a list or data frame if necessary) of 
unspecified size, which orders X[,1], ties broken by X[,2], remaining ties 
broken by X[,3] and so on - without having to know and to write down how 
many columns  X has.

Any ideas how to achieve that?

Thanks,
Christian

*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
chrish at stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche



More information about the R-help mailing list