Traverse a Python iterator or generator
Usage
as_iterator(x)
iterate(it, f = base::identity, simplify = TRUE)
iter_next(it, completed = NULL)
Arguments
- x
Python iterator or iterable
- it
Python iterator or generator
- f
Function to apply to each item. By default applies the
identity
function which just reflects back the value of the item.- simplify
Should the result be simplified to a vector if possible?
- completed
Sentinel value to return from
iter_next()
if the iteration completes (defaults toNULL
but can be any R value you specify).