partialOrder: Find partial order of smallest or largest values

Description Usage Arguments Value Author(s) See Also Examples

View source: R/utils.R

Description

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

Usage

1
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

1
2
3
4
5
6
# randomly draw some values
values <- rnorm(10)
values

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

robustHD documentation built on Nov. 23, 2021, 5:07 p.m.