lookup_function_from_dict: Creating a lookup function from dictionary

View source: R/purrr-like.R

lookup_function_from_dictR 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)


tidytidbits documentation built on March 18, 2022, 6:10 p.m.