grapes-OF-grapes: Get an element with condition that it must be from a list or...

%OF%R Documentation

Get an element with condition that it must be from a list or vector

Description

Get an element with condition that it must be from a list or vector

Usage

lhs %OF% rhs

Arguments

lhs

the element of candidate

rhs

the constraint

Value

Returns an element of length one that will be from rhs

Examples


# C is from LETTERS, therefore returns `C`
"C" %OF% LETTERS


# `lhs` is not from `rhs`, hence return the first element of LETTERS
'9' %OF% LETTERS
NULL %OF% LETTERS

# When there are multiple elements from `lhs`, select the first that
# matches the constraint
c('9', "D", "V") %OF% LETTERS


dipsaus documentation built on June 27, 2024, 5:10 p.m.