Learn R Programming

itertools (version 0.1-3)

recycle: Create a recycling iterator

Description

Create an iterator that recycles a specified iterable.

Usage

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

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

Run the code above in your browser using DataLab