max - Choosing highest number in vector and knowing its position in R -


i have vector in r:

y=c(-29.900900, 5.728916, 35.234331,  11.854811,  61.309519,  50.432798, -27.654741,  21.413622, -10.805339, -37.504199) 

i select highest number using example max(y).

then gives me 61.309519.

but in addition know position i.e. 5th element in vector.

is there way this? i'm ok using other data formats eg. matrix or data.frame

which.max()  

function return index of first maximum element. might important when have more 1 maximum in vector.


Comments

Popular posts from this blog

How can I fetch data from a web server in an android application? -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -

jquery - How can I dynamically add a browser tab? -