i_limit: Limit the length of an iterator.

View source: R/ilimit.R

i_limitR Documentation

Limit the length of an iterator.

Description

Create an iterator that limits the specified iterable to a specified number of items.

Usage

i_limit(iterable, n, ...)

Arguments

iterable

Iterable to iterate over.

n

Maximum number of values to return.

...

Extra arguments for iteror(iterable, ...)

Details

Originally from the itertools package.

Value

an iteror which will stop after yielding n values.

Examples


# Limit icount to only return three values
as.list(i_limit(icount(), 3))


iterors documentation built on May 31, 2023, 5:36 p.m.