timeout: Create a timeout iterator

Description Usage Arguments Examples

Description

Create an iterator that iterates over another iterator for a specified period of time, and then stops. This can be useful when you want to search for something, or run a test for awhile, and then stop.

Usage

1
timeout(iterable, time)

Arguments

iterable

Iterable to iterate over.

time

The time interval to iterate for, in seconds.

Examples

1
2
# See how high we can count in a tenth of a second
length(as.list(timeout(icount(), 0.1)))

Example output

Loading required package: iterators
[1] 7227

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