new_mapping: Low Level Constructor for Key-Value Mappings

Description Usage Arguments Examples

View source: R/mapping.R

Description

Low Level Constructor for Key-Value Mappings

Usage

1
new_mapping(key, value)

Arguments

key

vector from the domain

value

vector to which to map the keys

Right now mapping uses a named vector lookup, so only character vectors can be keys. This will be generalized to vectors in the future.

Examples

1
2
3
lookup <- new_mapping(c("m", "f", "u"), c("Male", "Female", NA))
x <- c("m", "f", "u", "f", "f", "m", "m")
lookup(x)

jameelalsalam/mapping documentation built on May 31, 2020, 2:39 p.m.