Learn R Programming

vectools (version 0.3.0)

50_unique-related_functions: Unique-Related Functions

Description

Convenience functions to test uniqueness, or to return the number of unique/duplication values, or a unique sorted vector.

The which.unique function returns a vector of indices. This will produce a vector of unique values, if the original vector is subsetted using the indices.

Usage

is.each.equal (v)
is.each.unique (v)

n.unique (v) n.duplicated (v)

which.unique (v)

usv (v)

Arguments

v

An integer/numeric vector.

See Also

Sequence Properties

Optimization-Related Functions

Other Sequence Functions

Examples

Run this code
# NOT RUN {
x <- c (2, 2, 1, 1, 10, 12)

n.unique (x)
usv (x)
# }

Run the code above in your browser using DataLab