Learn R Programming

lenses (version 0.0.3)

slab_l: Slab lens

Description

Create a lens into a chunk of an array (hyperslab). Uses the same syntactic rules as [.

Usage

slab_l(..., drop = FALSE)

Arguments

...

arguments as they would be passed to [ for example x[3,5,7].

drop

whether or not to drop dimensions with length 1. Only applies to view.

Examples

Run this code
# NOT RUN {
(x <- matrix(1:4, ncol = 2))
view(x, slab_l(2,)) # x[2,, drop = FALSE]
view(x, slab_l(2, 2)) # x[2,2, drop = FALSE]
set(x, slab_l(1,1:2), c(10,20))
# }

Run the code above in your browser using DataLab