ipad: Iterator that returns an object followed indefinitely by a...

Description Usage Arguments Value Examples

Description

Constructs an iterator that returns an iterable object before padding the iterator with the given fill value indefinitely.

Usage

1
ipad(object, fill = NA)

Arguments

object

an iterable object

fill

the value to pad the indefinite iterator after the initial object is consumed. Default: NA

Value

iterator that returns object followed indefinitely by the fill value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
it <- iterators::iter(1:9)
it_ipad <- ipad(it)
as.list(islice(it_ipad, end=9)) # Same as as.list(1:9)

it2 <- iterators::iter(1:9)
it2_ipad <- ipad(it2)
as.list(islice(it2_ipad, end=10)) # Same as as.list(c(1:9, NA))

it3 <- iterators::iter(1:9)
it3_ipad <- ipad(it3, fill=TRUE)
as.list(islice(it3_ipad, end=10)) # Same as as.list(c(1:9, TRUE))

itertools2 documentation built on May 2, 2019, 3:37 p.m.