change_names: Change names

Description Usage Arguments Author(s) Examples

View source: R/change_names.R

Description

Change rownames or colnames of a matrix/dataframe based on another matrix/dataframe

Usage

1
change_names(rowOrCol, Table, nameForTable)

Arguments

rowOrCol

Give "row" or "col" as input to decide where row names or column names are to be changed

Table

The table in which the row or column names are to be changed

nameForTable

A 2 column matrix/dataframe: 1st column/row: original names; 2nd column/row: new names

Author(s)

Peter I-Fan Wu

Examples

1
2
3
4
5
mat=matrix(c(1:12),nrow=3)
rownames(mat)=c("1","2","3")
new_row_names=c("one","two","three")

change_names(rowOrCol="row", mat, data.frame(original=rownames(mat), new=new_col_names))

peterwu19881230/microbialPhenotypes documentation built on March 19, 2021, 6:36 a.m.