Hi, Bill,
Thank you for your help. Your R script works very well.
Lisa
--
View this message in context:
http://r.789695.n4.nabble.com/Order-a-matrix-tp3547923p3548017.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.
help-boun...@r-project.org] On Behalf Of Lisa
> Sent: Tuesday, May 24, 2011 12:00 PM
> To: r-help@r-project.org
> Subject: [R] Order a matrix
>
> Dear all,
>
> I just want to order a matrix using several columns in a matrix. For
> example:
>
> x <- matrix(sample(c(1
Dear all,
I just want to order a matrix using several columns in a matrix. For
example:
x <- matrix(sample(c(1:5), 60, replace = T), 10, 6).
If I order the matrix by the first two columns, I will do it like this:
x[order(x[, 1], x[, 2]), ].
But when I repeat this work many times and the colu
That solved it!
Thank you very much!
On Mon, 5 Nov 2007, Prof Brian Ripley wrote:
> 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
>> ord
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 or
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
6 matches
Mail list logo