Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

renameColumns

Rename columns


Description

renameColumns renames columns of 'refMatr' using 2-column matrix (or data.frame) indicating old and new names (for replacement).

Usage

renameColumns(refMatr, newName, silent = FALSE, callFrom = NULL)

Arguments

refMatr

matrix (or data.frame) where column-names should be changed

newName

(matrix of character) giving correspondence of old to new names (number of lines must match number of columns of 'refMatr')

silent

(logical) suppres messages

callFrom

(character) allows easier tracking of message(s) produced

Value

matrix (or data.frame) with renamed columns

Examples

ma <- matrix(1:8,ncol=4,dimnames=list(1:2,LETTERS[1:4]))
replBy1 <- cbind(new=c("dd","bb","z_"),old=c("D","B","zz"))
replBy2 <- matrix(c("D","B","zz","dd","bb","z_"),ncol=2)
replBy3 <- matrix(c("X","Y","zz","xx","yy","z_"),ncol=2)
renameColumns(ma,replBy1)
renameColumns(ma,replBy2)
renameColumns(ma,replBy3)

wrMisc

Analyze Experimental High-Throughput (Omics) Data

v1.5.4
GPL-3
Authors
Wolfgang Raffelsberger [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.