sort_unique: Sort and unique

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/sort_unique.R

Description

Sort and unique numbers.

Usage

1
2

Arguments

x

A numeric vector.

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 but 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

1
2
3
4
5
6
7
8
9
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

Example output

Loading required package: Rcpp
Loading required package: RcppZiggurat
[1] TRUE
[1] 18
[1] 18

Rfast documentation built on May 18, 2021, 1:07 a.m.