Return index of maximal/minimal/best element in numerical vector
Source:R/getMaxIndex.R
getMaxIndex.RdIf x is empty or only contains NAs which are to be removed,
-1 is returned.
Usage
getMaxIndex(x, weights = NULL, ties.method = "random", na.rm = FALSE)
getMinIndex(x, weights = NULL, ties.method = "random", na.rm = FALSE)
getBestIndex(x, weights = NULL, minimize = TRUE, ...)Arguments
- x
[
numeric]
Input vector.- weights
[
numeric]
Weights (same length asx). If these are specified, the index is selected fromx * w. Default isNULLwhich means no weights.- ties.method
[
character(1)]
How should ties be handled? Possible are: “random”, “first”, “last”. Default is “random”.- na.rm
[
logical(1)]
IfFALSE, NA is returned if an NA is encountered inx. IfTRUE, NAs are disregarded. Default isFALSE- minimize
[
logical(1)]
Minimal element is considered best? Default isTRUE.- ...
[any]
Further arguments passed down to the delegate.