iterors 1.0
Initial release.
- Split off from “async” package.
- Incorporated/ported “iterators” package.
- Incorporated/ported “itertools” package.
- Incorporated/ported “itertools2” package.
New functions:
-
i_enumerate.arraycan iterate over arbitrary margins, providing you with a vector index. -
i_windowconstructs a sliding window of arbitrary length over a given iterator, generalizingitertools2::ipairwiseanditripletwise. - New functions
i_rle()andi_rle_inverse()for run-length encoding. - Introduced accumulation methods
i_accum(),reduce(), andsum()andprod(). -
i_chain(...)has a companion functioni_concat(it)which accepts an iterable (rather than...). - New iteror methods for
as.numeric,as.vector,as.character, andas.logical. -
concat()pastes chunks from an iterator into a vector.
New features:
- Memory-backed and counting iterors
icount,icountn,idiv,igrid,iseq,i_enumerate.default,iteror.default,iteror.data.frame,iteror.defaultandi_enumerate.arrayall have shared logic; all accept optionschunks,chunksizeandrecyclewith equivalent behavior. -
icountandicountnpreserve dimnames. - Multidimensional iterators
icountn,igrid,i_enumerate.arrayanditeror.arrayhave optionrowMajorto control the order of iteration. -
i_uniqueuses a hash table rather than linear scan, for much improved performance; it also now works with any type of R object. - Random number iterators like
irunif,isampleand friends accept optionsindependent, andseedif given, the iterator will maintain a private seed value, so that interleaving with other iterators does not affect reproducibility. You can use a specific random number generator algorithm by also givingkind,normal.kind, andsample.kind. -
i_teeworks for any iterator, using a queue, where previouslyitertools::i_teeonly worked for memory-backed iterators. - Python compatibility:
py_iterorwraps an iterator so that it can be used by Python code via packagereticulate. Meanwhileiterorhas a method for Python objects, allowing Python iterators to be used transparently with iteror code.