idiv.RdReturns an iterator that returns pieces of numeric value.
idiv(n, ..., chunks, chunkSize)number of times that the iterator will fire. If not specified, it will count forever.
unused.
the number of pieces that n should be divided into.
This is useful when you know the number of pieces that you want.
If specified, then chunkSize should not be.
the maximum size of the pieces that n
should be divided into.
This is useful when you know the size of the pieces that you want.
If specified, then chunks should not be.
The dividing iterator.
# divide the value 10 into 3 pieces
it <- idiv(10, chunks=3)
nextElem(it)
#> [1] 4
nextElem(it)
#> [1] 3
nextElem(it)
#> [1] 3
try(nextElem(it)) # expect a StopIteration exception
#> Error : StopIteration
# divide the value 10 into pieces no larger than 3
it <- idiv(10, chunkSize=3)
nextElem(it)
#> [1] 3
nextElem(it)
#> [1] 3
nextElem(it)
#> [1] 2
nextElem(it)
#> [1] 2
try(nextElem(it)) # expect a StopIteration exception
#> Error : StopIteration