sort_unique: Sort and unique

View source: R/sort_unique.R

Sort and unique numbers R Documentation

Sort and unique

Description

Sort and unique numbers.

Usage

sort_unique(x)
sort_unique.length(x)
Unique(x, fromLast = FALSE)

Arguments

x

A numeric vector.

fromLast

logical indicating if duplication should be considered from the last, i.e., the last (or rightmost) of identical elements will be kept. This only matters for names or dimnames.

Details

The "sort_unique" function implements R's "unique" function using C++'s function but also sort the result. The "sort_unique.length" returns the length of the unique numbers only for itegers.

Value

Returns the discrete values or sorted or their length (depending on the function you do).

Author(s)

Manos Papadakis

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>

See Also

colSort, rowSort, sort_cor_vectors

Examples

y <- rnorm(100)
a <- sort_unique(y)
b <- sort.int(unique(y))
all.equal(as.vector(a),as.vector(b))
x <- rpois(1000,10)
sort_unique.length(x)
length(sort_unique(x))

x<-a<-b<-NULL

Rfast documentation built on April 3, 2025, 11:34 p.m.