| icount {iterors} | R Documentation | 
Counting Iterators
Description
Returns an iterator that counts starting from one.
icountn(vn) takes a vector specifying an array size,
and returns an iterator over array indices. Each returned element
is a vector the same length as vn, with the first index varying fastest.
If vn has a names attribute the output will have the same names.
Usage
icount(count = Inf, ..., recycle = FALSE, chunkSize, chunks)
icountn(vn, ..., recycle = FALSE, chunkSize, chunks, rowMajor = TRUE)
Arguments
count | 
 number of times that the iterator will fire. Use NA or Inf to make an iterator that counts forever.  | 
... | 
 Undocumented  | 
recycle | 
 Whether to restart the count after finishing.  | 
chunkSize | 
 How many valies to return from each call to nextOr().  | 
chunks | 
 How many chunks to split the input. Either   | 
vn | 
 A vector of integers.  | 
rowMajor | 
 If   | 
Details
Originally from the iterators package.
Value
The counting iterator.
See Also
For more control over starting number and step size, see iseq.
Examples
# create an iterator that counts from 1 to 3.
it <- icount(3)
nextOr(it)
nextOr(it)
nextOr(it)
nextOr(it, NULL)  # expect NULL
x <- icount(5)
repeat print(nextOr(x, break))
it2 <- icount(100)
all.equal(as.numeric(it2), 1:100)
as.list(icountn(c(2, 3)))