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

Description Usage Arguments Value

View source: R/which.min2.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.min2(x, type = "first")

Arguments

x

[vector]
Source vector with numeric values.

type

[character]
String indicating how to handle multiple occurences of the minimal value. Possible values are "first", which leads to the know behavior of base::which.min, "last" which returns the index of the last occurence of the minimal 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 minimal value.


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