Learn R Programming

robustHD (version 0.8.1)

partialOrder: Find partial order of smallest or largest values

Description

Obtain a partial permutation that rearranges the smallest (largest) elements of a vector into ascending (descending) order.

Usage

partialOrder(x, h, decreasing = FALSE)

Value

An integer vector containing the indices of the h smallest or largest elements of x.

Arguments

x

a numeric vector of which to find the order of the smallest or largest elements.

h

an integer specifying how many (smallest or largest) elements to order.

decreasing

a logical indicating whether the sort order should be increasing (FALSE; the default) or decreasing (TRUE).

Author

Andreas Alfons

See Also

Examples

Run this code
# randomly draw some values
values <- rnorm(10)
values

# find largest observations
partialOrder(values, 5, decreasing = TRUE)

Run the code above in your browser using DataLab