Skip to contents

Determines the location, i.e. index, of the (first) minimum or maximum of a numeric (or logical) vector.

Usage

which_min_gc(x, empty_NA = TRUE)

which_max_gc(x, empty_NA = TRUE)

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.

empty_NA

logical, indicating if an empty value should be returned as NA (the default) or as integer(0) (the same as which.min and which.max).

Value

If empty_NA = FALSE, identical to which.min or

which.max

If empty_NA = TRUE, identical to which.min or

which.max except that, in cases where which.min or

which.max would return integer(0), which_min_gc and

which_max_gc return NA

Details

These functions are wrappers for which.min and which.max, with the additional argument empty_NA.