powered by
Obtain a partial permutation that rearranges the smallest (largest) elements of a vector into ascending (descending) order.
partialOrder(x, h, decreasing = FALSE)
An integer vector containing the indices of the h smallest or largest elements of x.
h
x
a numeric vector of which to find the order of the smallest or largest elements.
an integer specifying how many (smallest or largest) elements to order.
a logical indicating whether the sort order should be increasing (FALSE; the default) or decreasing (TRUE).
FALSE
TRUE
Andreas Alfons
order
# 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