top_indices: top_indices

View source: R/CodeAndRoll2.R

top_indicesR Documentation

top_indices

Description

Returns the positions of the n highest values in x. For equal values, it maintains the original order.

Usage

top_indices(x, n = 3, top = TRUE)

Arguments

x

A vector.

n

The number of highest values to return.

top

Whether to return the n highest (or n lowest) values.

Value

A vector of indices.

Examples

top_indices(rnorm(10), n = 3)


vertesy/CodeAndRoll2 documentation built on Nov. 20, 2024, 5:23 a.m.