[R] location of maximum

Laurent Gautier laurent at genome.cbs.dtu.dk
Tue Mar 5 19:22:35 CET 2002


Dear Patrick,


  What about:



x <- rnorm(100)
mx <- max(x)
exact.location <- which(x == mx)



   Hopin' it helps,



   Laurent




Laurent Gautier			CBS, Building 208, DTU
PhD. Student			D-2800 Lyngby,Denmark	
tel: +45 45 25 24 85		http://www.cbs.dtu.dk/laurent



On Tue, 5 Mar 2002, Patrick Buetzberger wrote:

> Dear R-users,
> 
> I'm trying to extract the exact location of the maximum value in a
> vector or a matrix, meaning I want not only the maximum itself but also
> at which position (e.g row 6, column 12) it is located.
> I appreciate any suggestions.
> Thanks,
> 
> Patrick
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list