which.min2: 'which.min' and 'which.max' for n indices

View source: R/utils.R

which.min2R Documentation

which.min and which.max for n indices

Description

Returns the indices of the first n min and max positions.

Usage

which.min2(x, n = 1L)

which.max2(x, n = 1L)

Arguments

x

numeric (logical, integer, or double) vector or an R object for which the internal coercion to double works whose min or max is searched for

n

the number of first min or max to return

See Also

which.min; which.max

Examples

x <- c(3, 1, 2, -2, 5)
stopifnot(identical(which.min(x), which.min2(x)))
stopifnot(identical(which.max(x), which.max2(x)))

which.min2(NA, 3)
which.min2(x, 3)
which.max2(x, 3)


raredd/rawr documentation built on April 29, 2024, 10:29 a.m.