indices_l {tinylens}R Documentation

Subset lens

Description

This function returns a lens that subsets the object in a generalized way.

Usage

indices_l(...)

i_l(...)

Arguments

...

Conditions to subset by. Unnamed arguments are used as indices. Named arguments are passed along to [ for viewing and are removed for setting.

Value

A lens that subsets the object by the specified indices

Examples

d <- data.frame(x = 1:10, y = 11:20, z = 21:30)
l <- indices_l(1, 1)
# get the first row of first column
view(d, l)
# set the first row of first column
set(d, l, 1)

# get the first row
l <- indices_l(1,)
view(d, l)
# set the first row
set(d, l, 1)

[Package tinylens version 0.1.0 Index]