Reputation: 1569
which.max
Determines the location, i.e., index of the (first) minimum or
maximum of a numeric vector. If the vector has multiple max, how can I retrieve all of them?
Upvotes: 20
Views: 18780
Reputation: 56945
You could do which( myVector == max(myVector) )
, which is basically what which.max
is (except that which.max
stops at the first occurence and is implemented a bit more efficiently).
Upvotes: 47