Construct a lens that is a view of the data with a new set of dimensions. Both view and set check that the new dimensions match the number of elements of the data.

reshape_l(dims)

Arguments

dims

a vector with the new dimensions

Examples

x <- 1:9 view(x, reshape_l(c(3,3)))
#> [,1] [,2] [,3] #> [1,] 1 4 7 #> [2,] 2 5 8 #> [3,] 3 6 9
set(x, reshape_l(c(3,3)) %.% diag_l, 100)
#> [1] 100 2 3 4 100 6 7 8 100