Description Usage Arguments Details Value Examples
Constructs an iterator that returns an iterable object in sequence over and over again.
1 |
object |
object to cycle indefinitely. |
times |
the number of times |
Runs indefinitely unless the times
argument is specified.
iterator that returns object
in sequence
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | it <- icycle(1:3)
iterators::nextElem(it) # 1
iterators::nextElem(it) # 2
iterators::nextElem(it) # 3
iterators::nextElem(it) # 1
iterators::nextElem(it) # 2
iterators::nextElem(it) # 3
iterators::nextElem(it) # 1
it2 <- icycle(1:3, times=2)
as.list(it2)
# Can return the results from a function.
it3 <- icycle(function() rnorm(1))
iterators::nextElem(it)
iterators::nextElem(it)
iterators::nextElem(it)
iterators::nextElem(it)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.