where_il {tinylens} | R Documentation |
Illegal lens into elements of a vector that satisfy a predicate.
where_il(p)
p |
A predicate function |
A lens that selects the elements that satisfy the predicate
d <- 1:10
l <- where_il(\(x) x %% 2 == 0)
view(d, l)
over(d, l, \(x) x / 2)