rename {lessR}R Documentation

Rename One or More Variables in a Data Frame

Description

rename renames a single variable or a vector of variables in a data frame.

Usage

rename(data, from, to)

Arguments

data

Data frame that contains the relevant variables.

from

One or more variables to rename.

to

Corresponding list of new variable names.

Details

Assign the result to the data frame of interest, which can be the same data frame that contains the variables to rename.

Author(s)

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

See Also

recode.

Examples


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

# single name change
d <- rename(d, m03, third)
names(d)

# vector of name changes
d <- rename(d, c(m01, m19), c(first, nineteen))
names(d)


[Package lessR version 4.3.3 Index]