Sort

Share:

Description

Sort a vector coresponding to another.

Usage

1
2
sort_cor_vectors(x,y)
sort_index(x, descending = FALSE)

Arguments

x

A numeric vector.

y

A numeric vector to help sorting the x.

descending

A logical value for choosing asceding or descending order.

Details

This function implements the R's "sort" function using the C++'s function sort.

Value

Returns the first argument but sorted acording to the second vector.

Author(s)

Manos Papadakis

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

See Also

sort_mat, sort_unique

Examples

1
2
3
4
y <- rnorm(100)
x <- rnorm(100)
b <- sort_cor_vectors(x,y)
b <- sort_index(x)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.