[R] how to get the position of an element in a vector ?

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Jul 3 16:30:37 CEST 2007


?which.max

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

 

> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op stat.math.ethz.ch 
> [mailto:r-help-bounces op stat.math.ethz.ch] Namens Benoit Chemineau
> Verzonden: dinsdag 3 juli 2007 16:12
> Aan: r-help op stat.math.ethz.ch
> Onderwerp: [R] how to get the position of an element in a vector ?
> 
> Hi, dear R developers,
> 
> I've got a vector of monthly volatilities and i would like to 
> get the position of the highest volatility of the vector 
> without computing a loop.
> Is there a function that could give me such a result ?
> 
> a<-c(1,2,4,100,3)
> 
> the highest value is the fourth of the vector.
> how can i get "4" without a loop going through the vector ?
> 
> Thanks !
> 
> Benoit.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help op stat.math.ethz.ch 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.
>



More information about the R-help mailing list