asplit
Split Array into List of Subarrays
Description
Splits an array into a list of its subarrays.
Usage
asplit(x, MARGIN)
Arguments
x |
an array or a matrix. Objects with no dimensions are treated as one-dimensional arrays.
|
MARGIN |
a vector of unique indices into dim(x).
|
Details
The splitting is done with split(x, slice.index(x, MARGIN)).
Value
returns a list with dimensions dim(x)[MARGIN], each of whose
elements is an array with dimensions dim(x)[notMARGIN],
where notMARGIN means the dimensions not in MARGIN.
Each array component is a slice of x.
See Also
Examples
str(asplit(array(letters[21:26],c(3,2)), MARGIN=2))
str(asplit(array(LETTERS[11:18],c(2,2,2)), MARGIN=c(3,1)))