Learn R Programming

SEset (version 1.0.1)

reorder_mat: Re-order rows and columns

Description

Takes a matrix and re-orders the rows and columns to some target ordering

Usage

reorder_mat(matrix, names)

Arguments

matrix

input matrix to be re-arranged. Must have rows and columns named

names

character vector containing the dimension names of the input matrix in the desired ordering

Value

input matrix with rows and columns sorted according to names

See Also

order_gen, network_to_SEset

Examples

Run this code
# NOT RUN {
data(riskcor)

# first define an ordered vector of names
row_names <- rownames(riskcor)
row_names_new <- row_names[c(1,2,3,4,6,5)]

reorder_mat(riskcor,row_names_new)

# The fifth and sixth row and column have been switched
print(riskcor)
# }

Run the code above in your browser using DataLab