encoder: Encode Vector

Description Usage Arguments Details Value Examples

View source: R/transform.R

Description

Match and Encode vector

Usage

1
encoder(x, match, encode = match, nomatch = c("NA", "original"))

Arguments

x

vector: input data to be matched.

match

vector: matching value to x

encode

vector: encoding vector same length as match

nomatch

Character: Indicate result if elements in x was not matched with match. It must be one of:

  • "NA": return NA

  • "original": return original elements in x

Details

Elements that not match will return values according to nomatch.

Value

encoded vector

Examples

1
2
encoder(c("a","b","d"), c("a","b","c"), c("A","B","C"))
encoder(c("a","b","d"), c("a","b","c"), c("A","B","C"), nomatch = "original")

Lightbridge-AI/lbr documentation built on Dec. 27, 2021, 8:09 p.m.