mapValues: Map values from One Vector to Another

Description Usage Arguments Value Examples

View source: R/mapValues.R

Description

Map values from One Vector to Another

Usage

1
mapValues(data, oldValue, newValue)

Arguments

data

a vector of strings where values will be replaced

oldValue

a vector that matches values in the data vector

newValue

a vector of new values that will replace the old values

Value

return the vector with the mapped values. If there was no corresponding entry then replace it with an NA.

Examples

1
2
3
4
data <- c("A", "B", "C", "X", "Y", "Z") 
oldValue <- LETTERS[1:20]
newValue <- letters[1:20]
results <- mapValues(data, oldValue, newValue)

paxtoolsr documentation built on Nov. 8, 2020, 8:29 p.m.