powered by
Remove or rename a variables in a data frame.
rename.vars(data, from="", to="", info=TRUE) remove.vars(data, names="", info=TRUE)
dataframe to be modified.
character vector containing the current name of each variable to be renamed.
character vector containing the new name of each variable to be renamed.
character vector containing the names of variables to be removed.
boolean value indicating whether to print details of the removal/renaming. Defaults to TRUE.
The updated data frame with variables listed in from renamed to the corresponding element of to.
from
to
names, colnames, data.frame
names
colnames
data.frame
data <- data.frame(x=1:10,y=1:10,z=1:10) names(data) data <- rename.vars(data, c("x","y","z"), c("first","second","third")) names(data) data <- remove.vars(data, "second") names(data)
Run the code above in your browser using DataLab