iapply {iterators} | R Documentation |
Returns an iterator over an array.
It iteratates over the array in much the same manner
as the apply
function.
iapply(X, MARGIN)
X |
the array to iterate over. |
MARGIN |
a vector of subscripts.
1 indicates the first dimension (rows), 2
indicates the second dimension (columns), etc. |
The apply iterator.
a <- array(1:8, c(2, 2, 2)) # iterate over all the matrices it <- iapply(a, 3) as.list(it) # iterate over all the columns of all the matrices it <- iapply(a, c(2, 3)) as.list(it) # iterate over all the rows of all the matrices it <- iapply(a, c(1, 3)) as.list(it)