Description Usage Arguments Details Value Author(s) Examples
Sorts the rows of a matrix by given columns.
1 | sortMat(mat,cols)
|
mat |
matrix. |
cols |
sequence os columns to sort by. |
It is just a interface to the function order
.
Matrix.
Gabriel Coelho Goncalves de Abreu (abreu_ga@yahoo.com.br)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | set.seed(1,kind="Mersenne-Twister")
a <- matrix(c(sample(2,6,TRUE),sample(3,6,TRUE),sample(2,6,TRUE)),
nrow=6)
x <- sortMat(mat=a, cols=c(1:3))
a
# [,1] [,2] [,3]
# [1,] 1 3 2
# [2,] 1 2 1
# [3,] 2 2 2
# [4,] 2 1 1
# [5,] 1 1 2
# [6,] 2 1 2
x
# [,1] [,2] [,3]
# [1,] 1 1 2
# [2,] 1 2 1
# [3,] 1 3 2
# [4,] 2 1 1
# [5,] 2 1 2
# [6,] 2 2 2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.