rename: Rename a Variable in a Data Frame

View source: R/rename.R

renameR Documentation

Rename a Variable in a Data Frame

Description

rename renames the specified variable in a data frame.

Usage

rename(data, from, to)

Arguments

data

Data frame that contains the variable to rename

from

Variable to be renamed.

to

New variable name.

Details

A simple wrapper for R code:

names(data)[which(names(data) == from)] <- to

Exists to save the extra complexity and typing when renaming a variable in a data frame.

Author(s)

David W. Gerbing (Portland State University; gerbing@pdx.edu)

See Also

recode.

Examples

d <- Read("Mach4", quiet=TRUE)

names(d)
d <- rename(d, m03, third)
names(d)

lessR documentation built on Nov. 12, 2023, 1:08 a.m.