R: Sort and unique

Sort and unique numbers {Rfast} | R Documentation

## Sort and unique

### Description

Sort and unique numbers.

### Usage

    sort_unique(x)
    sort_unique.length(x)

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

    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

[Package Rfast version 2.0.4 Index]