rename: Rename variable

Description Usage Arguments Details Author(s) See Also Examples

View source: R/rename.R

Description

rename Rename variable

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
rename(data, old.var, new.var)

## Default S3 method:
rename(...)

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

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

Arguments

data

Data Frame

old.var

R object or list

new.var

R object or list

...

Optional arguments

Details

rename changes the name of an existing variable old_varname to new_varname; the contents of the variable are unchanged.

Groups of variables can be also renamed by specifying variables in a list.

Author(s)

Myo Minn Oo (Email: dr.myominnoo@gmail.com | Website: https://myominnoo.github.io/)

See Also

ilog

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
infert.new <- rename(infert, age, AGE)
str(infert.new)

infert.new <- rename(infert, c(age, parity, induced, case),
               c(AGE, PARITY, INDUCED, CASE))
str(infert.new)

## End(Not run)

myominnoo/mStats_beta documentation built on Feb. 29, 2020, 8:17 a.m.