Re: [R] which.max2()

From: Esmail Bonakdarian <>
Date: Fri, 09 May 2008 13:24:25 -0400

Dimitris Rizopoulos wrote:
> try this:
> v <- rnorm(10)
> v
> order(v, decreasing = TRUE)[1:2]

Wow .. that is slick! First I thought, wait .. I don't want to reorder the elements, but this doesn't - it just returns the index values in order. I don't really get that from reading the documentation, it's probably there, but not that clear to me.

Thanks for showing me something more "R'ish".

Esmail mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 09 May 2008 - 17:51:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 09 May 2008 - 18:30:36 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive