On Mon, 5 Nov 2007, Christian Hennig wrote: > 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?
For a list or data frame, do.call("order", X). For a matrix, do.call("order", split(A, col(A))). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ 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.