The lens equivalent of @ and @<- for getting and setting S4 object slots.

slot_l(slot)

Arguments

slot

the name of the slot

Examples

new_class <- setClass("new_class", slots = c(x = "numeric")) (x <- new_class())
#> An object of class "new_class" #> Slot "x": #> numeric(0) #>
view(x, slot_l("x"))
#> numeric(0)
set(x, slot_l("x"), 1:10)
#> An object of class "new_class" #> Slot "x": #> [1] 1 2 3 4 5 6 7 8 9 10 #>