[R] Row number of minimum value?

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun May 17 12:57:40 CEST 2009



Adrian Dusa wrote:
> Hi Mike,
> 
> On Sunday 17 May 2009, MikSmith wrote:
>> Hi
>>
>> This *must* be an insanely easy thing to work out, but I'm not too familiar
>> with R syntax. So how do I work out the row number (if I pass a column) of
>> the minimum value?? I can get the value itself from min(), but where can I
>> get the row??
> 
> Maybe this helps:
> which(mycol == min(mycol))


... or which.min(mycol) for short.

Uwe Ligges



> where "mycol" is your column.
> Hth,
> Adrian
> 
>




More information about the R-help mailing list