over: Map a function over a lens

Description Usage Arguments Examples

View source: R/verbs.R

Description

Get the data pointed to by a lens, apply a function and replace it with the result.

Usage

1
over(d, l, f)

Arguments

d

the data (or an oscope)

l

the lens (or the function if d is an oscope)

f

the function (or nothing if d is an oscope)

Examples

1
2
3
third_l <- index(3)
over(1:5, third_l, function(x) x + 2)
# returns c(1:2, 5, 4:5)  

lenses documentation built on May 2, 2019, 8:51 a.m.