which.max2: More conventient function to get the index of the minimal...

Description Usage Arguments Value

View source: R/which.max2.R

Description

More conventient function to get the index of the minimal index in a numeric vector. (base::which.min only returns the first position of the minimum value).

Usage

1
which.max2(x, type = "first")

Arguments

x

[vector]
Source vector with numeric values.

type

[character]
String indicating how to handle multiple occurences of the maximal value. Possible values are "first", which leads to the know behavior of base::which.max, "last" which returns the index of the last occurence of the maximal element, "random", which chooses the position by dice roling and finally all, which returns a vector of all positions.

Value

[vector] Position(s) of the occurence(s) of the maximal value.


jakobbossek/JBmisc documentation built on May 18, 2019, 9:08 a.m.