[R] how to get the index of entry with max value in an array?

Feng Qiu hellokisas at gmail.com
Thu Jan 18 06:49:17 CET 2007


Thank you guys! I got it.

Best,

Feng

----- Original Message ----- 
From: "Benilton Carvalho" <bcarvalh at jhsph.edu>
To: "Feng Qiu" <hellokisas at gmail.com>
Cc: <r-help at stat.math.ethz.ch>
Sent: Thursday, January 18, 2007 12:20 AM
Subject: Re: [R] how to get the index of entry with max value in an array?


> which.max()
> b
> 
> On Jan 17, 2007, at 11:20 PM, Feng Qiu wrote:
> 
>> Hi all:
>>          A short question:
>>          For example,  a=[3,4,6,2,3], obviously the 3rd entry of  
>> the array has the maxium value, what I want is index of the maxium  
>> value: 3. is there a neat expression to get this index?
>>
>> Thank you!
>>
>> Best,
>>
>> Feng



More information about the R-help mailing list