map: Apply a mapping to a vector

Description Usage Examples

Description

A mnemonic for to[match(x, from)]. Compare with the more elaborate tran.

Usage

1
map(from, to, x)

Examples

1
2
3
4
x.from <- c('A',"FromNA",'Z','B',"N")
x.to   <- factor(c('a',NA,'z','b',NA),levels=c('z','a','b',NA))
x <- c("Z","B",NA,"N","M")
map(x.from, x.to, x)

gmonette/yscs documentation built on May 17, 2019, 7:28 a.m.