which.min(x) which.max(x)
TRUE
to 1 and
FALSE
to 0. Missing values are silently
ignored.
i
, such
that
x[i]==max(x,na.rm=TRUE)
. If there are no
nonmissing values in
x
then a zero-long
integer vector is returned.
This functions is written in C so it should be faster than the naive
which(x==max(x,na.rm=TRUE))[1]
.
> which.max(c(1,NA,10,5)) # [1] 3