recycle: Create a recycling iterator

Description Usage Arguments Examples

Description

Create an iterator that recycles a specified iterable.

Usage

1
recycle(iterable, times=NA_integer_)

Arguments

iterable

The iterable to recycle.

times

integer. Number of times to recycle the values in the iterator. Default value of NA_integer_ means to recycle forever.

Examples

1
2
# Recycle over 'a', 'b', and 'c' three times
recycle(letters[1:3], 3)

Example output

Loading required package: iterators
$nextElem
function () 
{
    nextEl.pointer()
}
<bytecode: 0x559ed3d6af00>
<environment: 0x559ed3d6aad8>

attr(,"class")
[1] "abstractiter" "iter"        

itertools documentation built on May 2, 2019, 2:26 p.m.