Learn R Programming

cppcontainers (version 1.0.4)

unique: Delete consecutive duplicates

Description

Erases consecutive duplicated values from the container by reference.

Usage

unique(x, incomparables, ...)

Value

Returns the number of deleted elements.

Arguments

x

A CppForwardList or CppList object.

incomparables

Ignored.

...

Ignored.

Details

Duplicated, non-consecutive elements are not removed.

incomparables and ... are only included for compatibility with the generic base::unique method and have no effect.

See Also

erase, remove., sort.

Examples

Run this code
l <- cpp_forward_list(c(4, 5, 6, 6, 4))
l
# 4 5 6 6 4

unique(l)
# [1] 1
l
# 4 5 6 4

Run the code above in your browser using DataLab