iteror functions by
taskis.iteror –
Check whether a function has class ‘iteror’.iteror – Generic
function to convert a given object into an iteror.nextOr – Obtain
the next element from an iteror.r_to_py.iteror
– Make an iteror act as a Python iterator (requires package
reticulate)Most of these functions are S3 generic.
as.character,
as.numeric,
as.logical,
as.list –
Collect all an iteror’s values into a vector.as.vector –
Collect values into a specified type of vector.concat – Paste
an iteror’s values end-to-end in one vector.consume – Take
all or some of an iteror’s elements and discard them.count – Compute
all elements, discard them and return their count.dotproduct –
Sum of products of corresponding elements of two iterors.nth – Compute and
discard the first \(n-1\) elements and
return the \(n\)th.prod.iteror –
Product of all an iteror’s values (i.e. reduce using
*.)quantify –
Consume an iteror and return how many elements were TRUE.record – Write
an iteror’s elements to a file.reduce – Combine
all of iteror’s values in sequence using a 2-argument function,
returning the final value.sum.iteror – Sum
all values of an iteror (i.e. reduce using
+.)take – Take some
number of elements and return them in a vector.By convention, functions in this package that construct an
iterator in terms of basic data or other objects have names beginning
with “i”.
ienum, ienumerate – return
the elements of an iterable alongside its index.i_enumerate
– return the elements of a vector or array alongside indices, optionally
chunked or recycled.i_repeat –
Return one value over and over again.iteror.array –
Iterate over an array along given dimensions.iteror.data.frame –
Iterate over rows or columns of a data frame.iteror.default –
Iterate over a vector from first to last index.i_combinations
– Enumerate all combinations of \(m\)
elements of a given vector, with or without replacement.i_count –
Produce an integer sequence starting with 1.i_countn –
Enumerate multiple indices, in either row-major or col-major order.i_div – Return a
sequence of \(n\) integers that add up
to a given total.i_grid – Produce
a sequence over the Cartesian product of the given vectors.i_permutations
– A sequence containing all permutations of a given vector.i_seq – Generate
arithmetic sequences with specific step size and origin.i_seq_along –
Counting sequence parallel to a given vector.Random number iterators can be made reproducible by specifying
independent=TRUE and specifying a seed value, though this
has a performance cost.
i_RNGStream, i_RNGSubStream –
Create a sequence of seed values so as to make parallel, decorrelated
random streams.i_rnbinom, irnorm, i_rpois, irunif, i_sample, irbinom – Draw samples
from the given distribution.i_read.table –
Reads row-wise from delimited text files.i_readBin –
Read binary data from file connections.i_readLines
– Read lines from text connections.i_readdf –
Read rows from several files in parallel (one per column).i_replay – reads
back values from a data file created with recordi_tabulate –
Evaluate a function over an arithmetic sequence.record – Write
values from an iterator to a file.iteror.function
– Create an iteror with custom behavior.By convention, in this package, functions that transform iterators –
creating a new iterator based on one or more underlying iterables –
begin with “i_”, with an underscore.
i_chunk –
Collect \(n\) adjacent values from an
iterable and return a list.i_pad – After a
given iterator ends, return a padding value indefinitely.i_recycle –
Record the values emitted by the underlying iterator and replay them in
a loop.i_rep – Repeat
each element of an iterable a given number of times.i_slice –
Return elements from an iterable based on a starting point and
stride.i_window –
Return adjacent elements from the underlying iteror in a sliding
window.i_accum – Apply
a 2-argument function between an iteror’s elements, and return a
sequence of partial totals.i_apply – Apply
a given function to each element.i_enumerate
– Return an index along with each element.i_star, i_starmap, i_map – Apply a
multiple-argument function to multiple parallel iterators.i_break –
Return elements only while the given (no-argument) function evaluates to
TRUE.i_dedup –
Discard elements that are identical the immediately preceding
element.i_drop – Discard
elements for which a criterion function returns TRUE.i_dropwhile
– Discard elements from an iterator until the criterion function
evaluates FALSE.i_keep – Keep
only elements for which an applied criterion function returns
TRUE.i_keepwhile
– Keep elements only until an applied criterion returns
FALSE.i_limit – Keep
only the first \(n\) elements from the
given iteror.i_mask – Return
elements for which a parallel iterator is TRUE.i_rle – Compress
runs of identical adjacent elements, returning one value and a run
length.i_rleinv –
Inverse transform of i_rle.i_timeout –
Return elements only until the timeout is reached.i_unique –
Pass along only unique elements of an iterator, using a hash table.i_chain –
String all values from each iterable argument together.i_concat –
String an iterable of iterables together.i_roundrobin –
Return one element at a time from each of a series of iterors in
rotation.i_tee – Split an
iterator into multiple iterators yielding the same sequence.i_zip – Combine
corresponding elements of parallel iterators into a list.i_zip_longest –
i_zip but pad any
iterators that end early.