Uses a list
of the same length as the dimensions of an array to extract
information, similar to using matrix indexing.
arrayExtractor(inarray, valslist)
inarray | The input array. |
---|---|
valslist | A list of vectors to use to extract data. A value of |
An array.
The list
used for valslist
must be the same length as the number of
dimensions in the array. It must also be specified in the same order as you
would normally reference the dimensions of an array. For instance, in the
example, the array has row dimensions, column dimensions, and a third
dimension.
http://stackoverflow.com/q/34795331/1270695
Ananda Mahto
my_array <- structure(1:12, .Dim = c(2L, 3L, 2L), .Dimnames = list(c("D_11", "D_12"), c("D_21", "D_22", "D_23"), c("D_31", "D_32"))) my_array#> , , D_31 #> #> D_21 D_22 D_23 #> D_11 1 3 5 #> D_12 2 4 6 #> #> , , D_32 #> #> D_21 D_22 D_23 #> D_11 7 9 11 #> D_12 8 10 12 #>#> , , D_31 #> #> D_21 D_22 D_23 #> D_11 1 3 5 #> #> , , D_32 #> #> D_21 D_22 D_23 #> D_11 7 9 11 #>#> , , D_32 #> #> D_21 #> D_11 7 #> D_12 8 #>#> , , D_31 #> #> D_21 D_22 #> D_11 1 3 #> D_12 2 4 #> #> , , D_32 #> #> D_21 D_22 #> D_11 7 9 #> D_12 8 10 #>