Learn R Programming

itertools (version 0.1-3)

ilimit: Create a limited iterator

Description

Create an iterator that wraps a specified iterable a limited number of times.

Usage

ilimit(iterable, n)

Arguments

iterable
Iterable to iterate over.
n
Maximum number of values to return.

Examples

Run this code
# Limit icount to only return three values
as.list(ilimit(icount(), 3))

Run the code above in your browser using DataLab