i_pad {iterors} | R Documentation |
Iterator that returns an object followed indefinitely by a fill value
Description
Constructs an iterator that returns an iterable object
before padding
the iterator with the given fill
value indefinitely.
Usage
i_pad(object, fill = NA, ...)
Arguments
object |
an iterable object |
fill |
the value to pad the indefinite iterator after the initial
|
... |
Passed along to iteror constructor. |
Value
iterator that returns object
followed indefinitely by the
fill
value
Examples
it <- iteror(1:9)
it_i_pad <- i_pad(it)
as.list(i_slice(it_i_pad, end=9)) # Same as as.list(1:9)
it2 <- iteror(1:9)
it2_i_pad <- i_pad(it2)
as.list(i_slice(it2_i_pad, end=10)) # Same as as.list(c(1:9, NA))
it3 <- iteror(1:9)
it3_i_pad <- i_pad(it3, fill=TRUE)
as.list(i_slice(it3_i_pad, end=10)) # Same as as.list(c(1:9, TRUE))
[Package iterors version 1.0 Index]