[R] Row number of minimum value?
MikSmith
mike at hsm.org.uk
Sun May 17 12:24:55 CEST 2009
Hi Adrian
Many thanks. That works perfectly! It's easy when you know the answer :)
mike
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))
>
> where "mycol" is your column.
> Hth,
> Adrian
>
>
> --
> Adrian Dusa
> Romanian Social Data Archive
> 1, Schitu Magureanu Bd.
> 050025 Bucharest sector 5
> Romania
> Tel.:+40 21 3126618 \
> +40 21 3120210 / int.101
> Fax: +40 21 3158391
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://www.nabble.com/Row-number-of-minimum-value--tp23578215p23582001.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list