ichunk {itertools} | R Documentation |
Create a chunking iterator
Description
Create an iterator that issues lists of values from the underlying iterable.
This is useful for manually “chunking” values from an iterable.
Usage
ichunk(iterable, chunkSize)
Arguments
iterable |
Iterable to iterate over. |
chunkSize |
Maximum number of values from iterable to
return in each value issued by the resulting iterator. |
See Also
isplitVector
Examples
# Split the vector 1:10 into "chunks" with a maximum length of three
it <- ihasNext(ichunk(1:10, 3))
while (hasNext(it)) {
print(unlist(nextElem(it)))
}
[Package
itertools version 0.1-1
Index]