idiv {iterors} | R Documentation |
Dividing Iterator
Description
Returns an iterator dividing a value into integer chunks, such that
sum(idiv(n, ...)) == floor(n)
Usage
idiv(count, ..., recycle = FALSE, chunkSize, chunks)
Arguments
count |
The total |
... |
Unused. |
recycle |
Whether to restart the count after finishing. |
chunkSize |
the maximum size of the pieces that |
chunks |
the number of pieces that |
Details
Originally from the iterators
package.
Value
The dividing iterator.
Examples
# divide the value 10 into 3 pieces
it <- idiv(10, chunks = 3)
nextOr(it)
nextOr(it)
nextOr(it)
nextOr(it, NULL) # expect NULL
# divide the value 10 into pieces no larger than 3
it <- idiv(10, chunkSize = 3)
nextOr(it)
nextOr(it)
nextOr(it)
nextOr(it)
nextOr(it, NULL) # end of iterator
[Package iterors version 1.0 Index]