isplitCols {itertools} | R Documentation |
Create an iterator that splits a matrix into block columns
Description
Create an iterator that splits a matrix into block columns.
You can specify either the number of blocks, using the chunks
argument, or the maximum size of the blocks, using the chunkSize
argument.
Usage
isplitCols(x, ...)
Arguments
x |
Matrix to iterate over. |
... |
Passed as the second and subsequent arguments to
|
Value
An iterator that returns submatrices of x
.
See Also
Examples
# Split a matrix into submatrices with a maximum of three columns
x <- matrix(1:30, 3)
it <- ihasNext(isplitCols(x, chunkSize=3))
while (hasNext(it)) {
print(nextElem(it))
}
# Split the same matrix into five submatrices
it <- ihasNext(isplitCols(x, chunks=5))
while (hasNext(it)) {
print(nextElem(it))
}
[Package itertools version 0.1-3 Index]