Learn R Programming

memisc (version 0.11-9)

rename: Change names of a named object

Description

rename changes the names of a named object.

Usage

rename(x, ...)

Arguments

x
Any named object
...
A sequence of named arguments, all of type character

Value

  • The object x with new names defined by the ...arguments.

Details

This function changes the names of x according to the remaining arguments. The argument names are the old names, the values are the new names.

Examples

Run this code
x <- c(a=1, b=2)
  rename(x,a="A",b="B")
  
  str(rename(iris,
                  Sepal.Length="SepalLength",
                  Sepal.Width ="SepalWidth",
                  Petal.Length="PetalLenght",
                  Petal.Width ="PetalWidth"
                  ))

Run the code above in your browser using DataLab