[R] find the index of the smallest or biggest number in a vetor or data.frame

Tsjerk Wassenaar tsjerkw at gmail.com
Thu Mar 19 16:00:51 CET 2009


?which


On Thu, Mar 19, 2009 at 2:15 PM, tedzzx <zengzhenxing at gmail.com> wrote:
>
> Dear R experts,
>
> How to find out the index of minimum or maxmum number in a vetor or
> data.frame?
>
> For example,
>
> a=
>
> n   price
> 1     50
> -2    100
> 0    200
> -1   300
> ......
>
>
> I want to find out the row which the n is the smallest or largestest and
> extract the price.
>
>
> Thanks
>
> Ted
> --
> View this message in context: http://www.nabble.com/find-the-index-of-the-smallest-or-biggest-number-in-a-vetor-or-data.frame-tp22599905p22599905.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



-- 
Tsjerk A. Wassenaar, Ph.D.
Junior UD (post-doc)
Biomolecular NMR, Bijvoet Center
Utrecht University
Padualaan 8
3584 CH Utrecht
The Netherlands
P: +31-30-2539931
F: +31-30-2537623




More information about the R-help mailing list