partialOrder: Find partial order of smallest or largest values

View source: R/utils.R

partialOrderR Documentation

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)

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).

Value

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

Author(s)

Andreas Alfons

See Also

order

Examples

# randomly draw some values
values <- rnorm(10)
values

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


robustHD documentation built on Sept. 27, 2023, 1:07 a.m.