Rename Variable in Dataframe

Description

Renames a variable in specified dataframe.

Usage

1
varRename(Data, From, To)

Arguments

Data

a dataframe object

From

vector of original name(s) of variable(s) as strings

To

vector of new name(s) of variable(s) as strings

Value

Returns dataframe with new variable names for specified variable(s)

Author(s)

John J. Curtin jjcurtin@wisc.edu

Examples

1
2
3
4
  d = data.frame(x=1:10, y=11:20)
  names(d)
  d = varRename(d, c('x', 'y'), c('x1', 'y1'))
  names(d)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.