Try this:
# for the minimum
a$price[which.min(a$n)]
# for the maximum
a$price[which.max(a$n)]
On Thu, Mar 19, 2009 at 10:15 AM, tedzzx 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
?which
On Thu, Mar 19, 2009 at 2:15 PM, tedzzx 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
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
-2100
0200
-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 messag
3 matches
Mail list logo