R: Sorting of the columns-rows of a matrix

Sorting of the columns-rows of a matrix {Rfast} | R Documentation

## Sorting of the columns-rows of a matrix

### Description

Fast sorting of the columns-rows of a matrix.

### Usage

    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)

### Arguments

`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.

### Value

The matrix with its columns-rows (or rows) independently sorted.

### Author(s)

Manos Papadakis

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.

### See Also

`nth, colMaxs, colMins, colrange, sort_cor_vectors, sort_unique`

### Examples

    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

[Package Rfast version 2.0.0 Index]