over {lenses} | R Documentation |
Map a function over a lens
Description
Get the data pointed to by a lens, apply a function and replace it with the result.
Usage
over(d, l, f)
Arguments
d |
the data (or an oscope) |
l |
the lens (or the function if |
f |
the function (or nothing if |
Examples
third_l <- index(3)
over(1:5, third_l, function(x) x + 2)
# returns c(1:2, 5, 4:5)
[Package lenses version 0.0.3 Index]