Learn R Programming

itertools (version 0.1-3)

irepeat: Create a repeating iterator

Description

Create an iterator that returns a value a specified number of times.

Usage

irepeat(x, times)

Arguments

x
The value to return repeatedly.
times
The number of times to repeat the value. Default value is infinity.

Examples

Run this code
# Repeat a value 10 times
unlist(as.list(irepeat(42, 10)))

Run the code above in your browser using DataLab