map: Apply a mapping to a vector

View source: R/tran.R

mapR Documentation

Apply a mapping to a vector

Description

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

Usage

map(from, to, x, ...)

Arguments

from

vector of values to be matched against

to

vector from which selected values are returned

x

vector of values to be matched

See Also

tran

tr

Examples

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/spida2 documentation built on Aug. 11, 2024, 7:52 p.m.