Sorting of the columns-rows of a matrix | R Documentation |
Fast sorting of the columns-rows of a matrix.
colSort(x, descending = FALSE, stable = FALSE, parallel=FALSE, cores = 0)
rowSort(x, descending = FALSE, stable = FALSE, parallel=FALSE, cores = 0)
sort_mat(x,by.row=FALSE,descending=FALSE,stable=FALSE,parallel=FALSE)
x |
A numerical matrix or data.frame 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. |
cores |
Number of cores to use for parallelism. Valid only when argument parallel is set to TRUE. Default value is 0 and it means the maximum supported cores. |
The matrix with its columns-rows (or rows) independently sorted.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
nth, colMaxs, colMins, colrange, sort_cor_vectors,
sort_unique
x <- matrix( rnorm(100 * 200), ncol = 200 )
s1 <- colSort(x)
#s2 <- apply(x, 2, sort)
#all.equal(as.vector(s1), as.vector(s2))
x<-NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.