powered by
Renames variables in a data frame.
renameColumns(x, from = "", to = "")
data frame to be modified.
character vector containing the current names of each variable to be renamed.
character vector containing the new names of each variable to be renamed.
The updated data frame x where the variables listed in from are renamed to the corresponding to column names.
colnames, recoder
# NOT RUN { x <- data.frame(x = 1:4, y = LETTERS[1:4]) renameColumns(x, from = c("x","y"), to = c("digits","letters")) # }
Run the code above in your browser using DataLab