%OF% {dipsaus} | R Documentation |
Get an element with condition that it must be from a list or vector
lhs %OF% rhs
lhs |
the element of candidate |
rhs |
the constraint |
Returns an element of length one that will be from rhs
# 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