| renameColumn | R Documentation |
Rename columns in a data.frame, matrix, tibble, or GRanges object
renameColumn(x, from, to, verbose = FALSE, ...)
x |
|
from |
|
to |
|
verbose |
|
... |
Additional arguments are ignored. |
This function is intended to rename one or more columns in a
data.frame, matrix, tibble, or GRanges related object.
It will gracefully ignore columns which do not match,
in order to make it possible to call the
function again without problem.
This function will also recognize input objects GRanges,
ucscData, and IRanges, which store annotation in DataFrame
accessible via S4Vectors::values(). Note the IRanges package
is required, for its generic function values().
The values supplied in to and from are converted from factor
to character to avoid coersion by R to integer, which was
noted in output prior to jamba version 0.0.72.900.
data.frame or object equivalent to the input x,
with columns from renamed to values in to. For genomic
ranges objects such as GRanges and IRanges, the colnames
are updated in S4Vectors::values(x).
Other jam practical functions:
breakDensity(),
call_fn_ellipsis(),
checkLightMode(),
check_pkg_installed(),
colNum2excelName(),
color_dither(),
exp2signed(),
getAxisLabel(),
isFALSEV(),
isTRUEV(),
jargs(),
kable_coloring(),
lldf(),
log2signed(),
middle(),
minorLogTicks(),
newestFile(),
printDebug(),
reload_rmarkdown_cache(),
rmInfinite(),
rmNA(),
rmNAs(),
rmNULL(),
setPrompt()
df <- data.frame(A=1:5, B=6:10, C=11:15);
df;
df2 <- renameColumn(df,
from=c("A","C"),
to=c("a_new", "c_new"));
df2;
df3 <- renameColumn(df2,
from=c("A","C","B"),
to=c("a_new", "c_new","b_new"));
df3;
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.