Rfast (version 1.7.3)

Sorting of the columns of a matrix: Sorting of the columns of a matrix

Description

Fast sorting of the columns of a matrix.

Usage

sort_mat(x)

Arguments

x
A numerical matrix with data.

Value

The matrix with its columns independently sorted.

See Also

nth, colMaxs, colMins, colrange, sort_cor_vectors, sort_index, sort_unique

Examples

Run this code
x <- matrix( rnorm(1000 * 500), ncol = 500 )
system.time( s1 <- sort_mat(x) )
system.time( s2 <- apply(x, 2, sort)  )
all.equal(as.vector(s1), as.vector(s2))

Run the code above in your browser using DataLab