Find the maximum position in a vector, breaking ties at random.

which.is.max(x)

Arguments

x

a vector

Value

index of a maximal value.

Details

Ties are broken at random.

See also

max.col, which.max which takes the first of ties.

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

Examples

if (FALSE) ## this is incomplete
pred <- predict(nnet, test)
table(true, apply(pred, 1, which.is.max))
#> Error: object 'true' not found
 # \dontrun{}