isplitIndices {itertools} | R Documentation |
Create an iterator of chunks of indices from 1 to n
.
You can specify either the number of pieces, using the chunks
argument, or the maximum size of the pieces, using the chunkSize
argument.
isplitIndices(n, ...)
n |
Maximum index to generate. |
... |
Passed as the second and subsequent arguments to
|
An iterator that returns vectors of indices from 1 to n
.
# Return indices from 1 to 17 in vectors no longer than five it <- ihasNext(isplitIndices(17, chunkSize=5)) while (hasNext(it)) { print(nextElem(it)) } # Return indices from 1 to 7 in four vectors it <- ihasNext(isplitIndices(7, chunks=4)) while (hasNext(it)) { print(nextElem(it)) }