[R] index of max value ?
Corey Moffet
cmoffet at nwrc.ars.usda.gov
Fri Nov 14 20:40:59 CET 2003
?which
v <- c(6, -3, -6, 15, 7, 9, 0 -19)
v
which(v == max(v))
At 02:05 PM 11/14/2003 -0500, ryszard.czerminski at pharma.novartis.com wrote:
>Is there a function in R, which would return index of maximum value
>in a vector ?
>
>e.g.
>
>> v <- round(10*rnorm(8))
>> v
>[1] 6 -3 -6 15 7 9 0 -19
>> max(v)
>[1] 15
>
>??? index.max(v)
>??? 4
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
With best wishes and kind regards I am
Sincerely,
Corey A. Moffet
Rangeland Scientist
USDA-ARS
Northwest Watershed Research Center
800 Park Blvd, Plaza IV, Suite 105
Boise, ID 83712-7716
Voice: (208) 422-0718
FAX: (208) 334-1502
More information about the R-help
mailing list