renameColumns: Rename columns or do nothing if the names don't match

Description Usage Arguments Value Examples

View source: R/utilities.R

Description

Rename columns or do nothing if the names don't match

Usage

1
renameColumns(x, values)

Arguments

x

An object for which colnames is defined, probably a data.frame or other similar object.

values

A character vector where names are the old column names and values are the new column names. Uses gsub internally to do the renaming.

Value

x with the updated column names if they are present. Does not fail if the column names are missing.

Examples

1
2
x <- data.frame(a=factor(LETTERS[1:5]), b=factor(runif(5, 0, 1)))
renameColumns(x, c(a='c'))

bhklab/PanCuRx documentation built on Dec. 30, 2021, 4:59 p.m.