[R] index of max value ?
James MacDonald
jmacdon at med.umich.edu
Fri Nov 14 20:17:19 CET 2003
which(v==max(v)) should do the trick.
HTH,
Jim
James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623
>>> <ryszard.czerminski at pharma.novartis.com> 11/14/03 02:05PM >>>
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
More information about the R-help
mailing list