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, cores = 0)
rowSort(x, descending = FALSE, stable = FALSE, parallel=FALSE, cores = 0)
sort_mat(x,by.row=FALSE,descending=FALSE,stable=FALSE,parallel=FALSE)

Arguments

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.

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 * 200), ncol = 200 )
s1 <- colSort(x)
#s2 <- apply(x, 2, sort)
#all.equal(as.vector(s1), as.vector(s2))

x<-NULL

[Package Rfast version 2.1.0 Index]