iunique_justseen {itertools2}R Documentation

Iterator that extracts the just-seen unique elements from an iterable object

Description

Constructs an iterator that extracts each unique element in turn from an iterable object. Order of the elements is maintained. Only the element just seen is remembered for determining uniqueness.

Usage

iunique_justseen(object)

Arguments

object

an iterable object

Value

an iterator that returns the just-seen unique elements from object

Examples

it <- ichain(rep(1,4), rep(2, 5), 4:7, 2)
it_iunique <- iunique_justseen(it)
as.list(it_iunique) # 1 2 4 5 6 7 2

it2 <- iterators::iter(c('a', 'a', "A", 'a', 'a', "V"))
it2_iunique <- iunique_justseen(it2)
as.list(it2_iunique) # a A a V

[Package itertools2 version 0.1.1 Index]