[R] Programming puzzle...
Ron Wehrens
rwehrens at sci.kun.nl
Thu Jul 13 15:37:24 CEST 2000
Dear R guru's,
I'd like to sort the columns of a matrix according to the elements in the
first row, and in case of a tie according to the second row, etc.
In case of a 3xn matrix woppa, something like
colorder _ order(woppa[1,], woppa[2,], woppa[3,])
I just cannot seem to find a way to do this for a variable number of rows,
e.g. if woppa has 10 or 15 rows I now manually cut and paste to have 10 - 15
arguments in the order function. There has to be a clever way to do this...
Ron
-----------------------+--------------------------------------------------
Ron Wehrens | " In a purely metaphorical sense, I am a turnip "
Dept. of Chemometrics | (W.A. Quayle)
University of Nijmegen | Email: rwehrens at sci.kun.nl
Toernooiveld 1 | http://www-cac.sci.kun.nl/cac/rwehrens
6525 ED Nijmegen | Tel: +31 24 365 2053
The Netherlands | Fax: +31 24 365 2653
-----------------------+------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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