Learn R Programming

ribiosUtils (version 1.5-6)

sortByDimnames: Sort matrix by dim names

Description

Rearrange rows and columns of a matrix by dim names

Usage

sortByDimnames(x, row.decreasing = FALSE, col.decreasing = FALSE)

Arguments

x

A matrix or data.frame

row.decreasing

Logical, whether rows should be sorted decreasingly

col.decreasing

Logical, whether columns should be sorted decreasingly

Value

Resorted matrix or data frame

Examples

Run this code
# NOT RUN {
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