Skip to content
Prev 524 / 15274 Next

Sorting

Hi Lorenzo,

# given this 2 x N matrix

N <- 10^5
A <- matrix(rnorm(2*N),2)

# use the following statement to sort the column vectors by their elements
in the i-th row

i <- 1
A <- A[,order(A[i,])]

Hope this helps,
Rainer