SortRows {SSBtools} | R Documentation |
Sorting rows of a matrix or data frame
Description
Sorting rows of a matrix or data frame
Usage
SortRows(m, cols = 1:dim(m)[2], index.return = FALSE)
Arguments
m |
matrix or data frame |
cols |
Indexes of columns, in the desired order, used for sorting. |
index.return |
logical indicating if the ordering index vector should be returned instead of sorted input. |
Value
sorted m
or a row index vector
Author(s)
Øyvind Langsrud
Examples
d <- SSBtoolsData("d2w")
SortRows(d[4:7])
SortRows(d, cols = 4:7)
SortRows(d, cols = c(2, 4))
SortRows(matrix(sample(1:3,15,TRUE),5,3))
[Package SSBtools version 1.5.2 Index]