Fast Renaming Objects
A fast substitute for dplyr::rename
. setrename
renames objects by reference. These functions also work with objects other than data frames that have a 'names' attribute.
frename(.x, ..., cols = NULL) setrename(.x, ..., cols = NULL)
.x |
an R object with a 'names' attribute. |
... |
either tagged vector expressions of the form |
cols |
If |
.x
renamed.
## Using tagged expressions head(frename(iris, Sepal.Length = SL, Sepal.Width = SW, Petal.Length = PL, Petal.Width = PW)) head(frename(iris, Sepal.Length = "S L", Sepal.Width = "S W", Petal.Length = "P L", Petal.Width = "P W")) ## Using a function head(frename(iris, tolower)) head(frename(iris, tolower, cols = 1:2)) head(frename(iris, tolower, cols = is.numeric)) head(frename(iris, paste, "new", sep = "_", cols = 1:2)) ## Renaming by reference setrename(iris, tolower) head(iris) rm(iris)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.