[R] Order by the columns

2007-07-30 Thread Am Stat
Dear useR, I have a data matrix, it has n columns, each column is a two-level variable with entires -1 and +1. They are randomly generated, now I want to order them like (for example, 5 columns case) --- - - -- - -- . (first several rows are the samples

Re: [R] Order by the columns

2007-07-30 Thread jim holtman
?order You could do something like: mat[order(mat[,1], mat[,2], mat[,3]),] On 7/29/07, Am Stat [EMAIL PROTECTED] wrote: Dear useR, I have a data matrix, it has n columns, each column is a two-level variable with entires -1 and +1. They are randomly generated, now I want to order them like