Sorting of the columns-rows of a matrix
Fast sorting of the columns-rows of a matrix.
colSort(x, descending = FALSE, stable = FALSE,parallel=FALSE) rowSort(x, descending = FALSE, stable = FALSE,parallel=FALSE) sort_mat(x,by.row=FALSE,descending=FALSE,stable=FALSE,parallel=FALSE)
x |
A numerical matrix with data. |
descending |
If you want the sorting in descending order, set this to TRUE. |
stable |
If you the stable version, so that the results are the same as R's (in the case of ties) set this to TRUE. If this is TRUE, the algorithm is a bit slower. |
parallel |
Do you want to do it in parallel in C++? TRUE or FALSE. Works with every other argument. |
by.row |
TRUE or FALSE for applying sort in rows or column. |
The matrix with its columns-rows (or rows) independently sorted.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
x <- matrix( rnorm(100 * 500), ncol = 500 ) system.time( s1 <- colSort(x) ) system.time( s2 <- apply(x, 2, sort) ) all.equal(as.vector(s1), as.vector(s2)) x<-NULL
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.