lookup_function_from_dict {tidytidbits}R Documentation

Creating a lookup function from dictionary

Description

Creating a lookup function from dictionary

Usage

lookup_function_from_dict(dict, default = identity, dict_key_is_regex = F)

Arguments

dict

A dictionaryish character vector (named: key -> value)

default

Value to return if key is not found, or function to evaluate with key as argument

dict_key_is_regex

If True, treats dictionary keys are regular expressions when matching

Value

A function which can be called with keys and performs the described lookup, returning the value (string)


[Package tidytidbits version 0.3.2 Index]