reorder_matrix: reorder_matrix

Description Usage Arguments Value Examples

Description

This function reorders matrix rows and columns based on names of another vector

Usage

1
reorder_matrix(mat, new_order)

Arguments

mat

matrix

new_order

characters with new order for rows & columns (names)

Value

reordered matrix

Examples

1
2
3
4
5
6
7
8
9
##Create matrix
M<-replicate(5, rnorm(5))
rownames(M)<-LETTERS[1:5]
colnames(M)<-LETTERS[1:5]

##New order
reorder<-c("E","C","A","B","E")

new_order_matrix<-reorder_matrix(M,reorder)

mrmrmrmrmrmr/network documentation built on May 14, 2019, 6 a.m.