Learn R Programming

Jmisc (version 0.3.1.1)

recode: Recode the value of a vector

Description

Recode the value of a vector or matrix.

Usage

recode(x, from, to)

Arguments

x

a vector or matrix

from

original value of x

to

new value of x

Value

recoded x

Examples

Run this code
# NOT RUN {
x=rep(1:5,each=2)
recode(x,from=1:5,to=5:1)
recode(x,from=1:5,to=11:15)
# }

Run the code above in your browser using DataLab