partialOrder | R Documentation |
Obtain a partial permutation that rearranges the smallest (largest) elements of a vector into ascending (descending) order.
partialOrder(x, h, decreasing = FALSE)
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 ( |
An integer vector containing the indices of the h
smallest or
largest elements of x
.
Andreas Alfons
order
# randomly draw some values
values <- rnorm(10)
values
# find largest observations
partialOrder(values, 5, decreasing = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.