Description Usage Arguments Value See Also Examples
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.
1 | 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
.
1 2 3 4 5 6 7 8 9 10 11 | # 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))
}
|
Loading required package: iterators
[1] 1 2 3 4 5
[1] 6 7 8 9
[1] 10 11 12 13
[1] 14 15 16 17
[1] 1 2
[1] 3 4
[1] 5 6
[1] 7
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.