Learn R Programming

SciencesPo (version 1.02.12)

rename: Rename a variable

Description

Rename a variable.

Usage

rename(old, new, data, ...)

## S3 method for class 'default': rename(old, new, data, ...)

## S3 method for class 'var': rename(old, new, data, ...)

## S3 method for class 'pattern': rename(old, new, data, verbose = TRUE, ...)

Arguments

old
a variable or a pattern among the names of the variables inside data.
new
new name or new pattern of the variable(s).
data
a data.frame of which the variables will be renamed.
verbose
whether the old and new names of the variables(s) should be printed out.
...
further arguments passed to or used by other methods.

encoding

UTF-8

Examples

Run this code
data(ssex)
rename("Oppose", "NO", data = ssex)

Run the code above in your browser using DataLab