[R] how to find index of maximum?

Martin Maechler maechler at stat.math.ethz.ch
Mon Jul 12 16:49:47 CEST 1999

    Peter> Dear R-users, Is there a simple way to find the index of the
    Peter> maximum of a vector?

Peter meant:
     Something more efficient than

      		  x == max(x)
		which(x == max(x))
		match(max(x), x)

    Peter> Ex.

    Peter> 1 3 6 2

    Peter> result: 3

    Peter> Thanks for any help, Peter

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list