renameCol {doBy} | R Documentation |
Rename columns in a matrix or a dataframe.
Description
Rename columns in a matrix or a dataframe.
Usage
renameCol(indata, src, tgt)
Arguments
indata |
A dataframe or a matrix |
src |
Source: Vector of names of columns in |
tgt |
Target: Vector with corresponding new names in the output. |
Value
A dataframe if indata
is a dataframe; a matrix in
indata
is a matrix.
Author(s)
Søren Højsgaard, sorenh@math.aau.dk
Examples
renameCol(CO2, 1:2, c("kk", "ll"))
renameCol(CO2, c("Plant", "Type"), c("kk", "ll"))
# These fail - as they should:
# renameCol(CO2, c("Plant", "Type", "conc"), c("kk", "ll"))
# renameCol(CO2, c("Plant", "Type", "Plant"), c("kk", "ll"))
[Package doBy version 4.6.22 Index]