which_min {countries}R Documentation

Return location of minimum, maximum and mode values' index

Description

These function return the position (index) of all the minimum, maximum, and mode values of the vector x. which_min() and which_max() only support numeric and logical vectors. These functions are identical to which.min() and which.max(), except that ALL minima/maxima are returned instead of only the first one.

Usage

which_min(x, first_only = FALSE)

which_max(x, first_only = FALSE)

which_mode(x, first_only = FALSE)

Arguments

x

A numeric or vector

first_only

Logical value indicating whether only the first value should be returned (i.e. if TRUE the function behaves like which.min() and which.max()). Default is FALSE.

Value

Returns the position of the minimum, maximum and mode values of a vector x

See Also

Mode, which.min, which.max

Examples

which_mode(c("a","a",2,3))
which_min(c(1,1,2,3,NA,2))
which_max(c(NA,NA,NA,1,1,2))

[Package countries version 1.2.0 Index]