idedup | R Documentation |
Constructs an iterator that removes runs of repeated elements from the underlying iterator. Order of the elements is maintained. Only the element just seen is remembered for determining whether to drop.
idedup(object, cmp = identical, ...)
object |
an iterable object |
cmp |
A function to use for comparison. |
... |
passed along to |
Originated as itertools2::iunique_lastseen
.
object
.
an iterator that skips over duplicate items from teh unterlying iterator.
i_rle
it <- i_chain(rep(1,4), rep(2, 5), 4:7, 2)
it_i_unique <- idedup(it)
as.list(it_i_unique) # 1 2 4 5 6 7 2
it2 <- iteror(c('a', 'a', "A", 'a', 'a', "V"))
i_dedupe <- idedup(it2)
as.list(idedup) # a A a V
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.