rename {lessR}R 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)

[Package lessR version 4.3.0 Index]