Skip to contents

Indicate the index of the row-wise minimal value

Usage

which.pmin(..., silent = FALSE)

which.pmin_chr(..., ties = c("warning-first", "first", "collapse"))

Arguments

...

Vectors of the same type where which.min is applied.

silent

lgl. Indicate if the function should return a warning in case of duplicated minimal.

ties

chr. Method use in case of ties. Either "warning-first", default which return a warning a select the name of the first input, OR "first", return the first input, OR "collapse", collapse the tied input with " | ".

Value

an integer vector indicating the row-wise index of the (first) minimal value

Details

See original idea https://github.com/radiant-rstats/radiant.data/blob/master/R/radiant.R

Examples


which.pmin(a=1:5,b =5:1,silent = TRUE)
#> [1] 1 1 1 2 2
which.pmin_chr(a=1:5,b =5:1,ties="first")
#> [1] "a" "a" "a" "b" "b"
which.pmin_chr(a=1:5,b =5:1,ties="collapse")
#> [1] "a"     "a"     "a | b" "b"     "b"