Description Usage Arguments Value Examples
Constructs an iterator that traverses each given iterable in a roundrobin order. That is, the iterables are traversed in an alternating fashion such that the each element is drawn from the next iterable. If an iterable has no more available elements, it is skipped, and the next element is taken from the next iterable having available elements.
1 |
... |
multiple arguments to iterate through in roundrobin sequence |
iterator that alternates through each argument in roundrobin sequence
1 2 3 4 5 6 7 | it <- iterators::iter(c("A", "B", "C"))
it2 <- iterators::iter("D")
it3 <- iterators::iter(c("E", "F"))
as.list(iroundrobin(it, it2, it3)) # A D E B F C
it_rr <- iroundrobin(1:3, 4:5, 7:10)
as.list(it_rr) # 1 4 7 2 5 8 3 9 10
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.