rename {plyr} | R Documentation |
Modify names by name, not position.
Description
Modify names by name, not position.
Usage
rename(x, replace, warn_missing = TRUE, warn_duplicated = TRUE)
Arguments
x |
named object to modify |
replace |
named character vector, with new names as values, and old names as names. |
warn_missing |
print a message if any of the old names are
not actually present in |
warn_duplicated |
print a message if any name appears more
than once in |
Examples
x <- c("a" = 1, "b" = 2, d = 3, 4)
# Rename column d to "c", updating the variable "x" with the result
x <- rename(x, replace = c("d" = "c"))
x
# Rename column "disp" to "displacement"
rename(mtcars, c("disp" = "displacement"))
[Package plyr version 1.8.9 Index]