powered by
Rearrange rows and columns of a matrix by dim names
sortByDimnames(x, row.decreasing = FALSE, col.decreasing = FALSE)
Resorted matrix or data frame
A matrix or data.frame
Logical, whether rows should be sorted decreasingly
Logical, whether columns should be sorted decreasingly
Jitao David Zhang <jitao_david.zhang@roche.com>
testMat <- matrix(1:16, nrow=4, dimnames=list(c("B", "D", "A", "C"), c("t", "f", "a", "g"))) sortByDimnames(testMat) sortByDimnames(testMat, row.decreasing=TRUE, col.decreasing=FALSE)
Run the code above in your browser using DataLab