icount {iterators} | R Documentation |
Returns an iterator that counts starting from one.
icount(count)
icountn(vn)
count |
number of times that the iterator will fire. If not specified, it will count forever. |
vn |
vector of counts. |
The counting iterator.
# create an iterator that counts from 1 to 3.
it <- icount(3)
nextElem(it)
nextElem(it)
nextElem(it)
try(nextElem(it)) # expect a StopIteration exception