Learn R Programming

Dict (version 0.6)

detect_key: Finds the key of the first match

Description

See detect. This function calls the predicate .p on the values of dict, and returns the first key for which the predicate is TRUE.

Usage

detect_key(dict, .p, ..., .right = FALSE)

Arguments

dict
a dictionary
.p
a single predicate function (see detect), which is passed the values of dict
...
additional parameters passed to .p
.right
whether to start the search from the beginning or end of the dictionary

Value

the first match for which the predicate is TRUE