map_l {tinylens} | R Documentation |
Lens into a list or vector
Description
This lens allows you to access and modify elements of a list or vector based on their position or a logical condition.
Usage
map_l(l, .ptype = NULL)
Arguments
l |
A lens that selects the elements to lens into |
.ptype |
The prototype of the data structure to return |
Value
A lens that selects the specified elements
Examples
d <- list(list(a = 1, b = 2), list(a = 4, b = 9))
l <- index_l("a")
view(d, map_l(l))
over_map(d, map_l(l), sqrt)
[Package tinylens version 0.1.0 Index]