Learn R Programming

futile.matrix (version 1.2.7)

arrange: Order matrix elements based on rownames and/or colnames

Description

This is a convenience function for ordering rows and columns within a matrix.

Usage

arrange(m, order.rows = TRUE, order.cols = TRUE, comparator = NULL)

Arguments

m

A matrix whose rows and/or columns are to be arranged

order.rows

Whether rows are to be ordered. Defaults to TRUE

order.cols

Whether columns are to be ordered. Defaults to TRUE

comparator

A function to define the ordering. Currently unused

Value

A matrix whose rows and/or columns have been ordered. By default, both rows and columns are ordered.

Details

To ensure proper operations are performed, the ordering of rows and columns within matrix operands must be consistent. Arrange conveniently performs this ordering.

In the future, a comparator will be added so that custom orderings can be applied to the function.

Examples

Run this code
# NOT RUN {
library(datasets)
arrange(state.x77)
# }

Run the code above in your browser using DataLab