| icount | R Documentation | 
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.
icount(count = Inf, ..., recycle = FALSE, chunkSize, chunks)
icountn(vn, ..., recycle = FALSE, chunkSize, chunks, rowMajor = TRUE)
| 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  | 
Originally from the iterators package.
The counting iterator.
For more control over starting number and step size, see iseq.
# 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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.