Learn R Programming

BBmisc (version 1.10)

getMaxIndex: Return index of maximal/minimal element in numerical vector.

Description

If x is empty or only contains NAs which are to be removed, -1 is returned.

Usage

getMaxIndex(x, ties.method = "random", na.rm = FALSE)
getMinIndex(x, ties.method = "random", na.rm = FALSE)

Arguments

x
[numeric] Input vector.
ties.method
[character(1)] How should ties be handled? Possible are: “random”, “first”, “last”. Default is “random”.
na.rm
[logical(1)] If FALSE, NA is returned if an NA is encountered in x. If TRUE, NAs are disregarded. Default is FALSE

Value

[integer(1)].