Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible Url : https://stat.ethz.ch/pipermail/r-help/attachments/20070404/5a865ee8/attachment.pl
x <- c(1,4,15,6,7) which(x==max(x))> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of > croero at hotmail.com > Sent: Wednesday, April 04, 2007 11:14 AM > To: r-help at stat.math.ethz.ch > Subject: [R] argmax > > Hello, > > Is there any function that returns the argmax of a vector ? > > For example I have the vector x=(1,4,15,6,7) > > max(x)=15 > > I want a function f such that f(x)=3 because this is where max(x) is. > > Thank your very much. > > P.S. : I know it is a basic question but I have not figured > it out by myself. > _________________________________________________________________ > > ues clics pour retrouver tout ce qui vous int?resse au m?me endroit. > > [[alternative HTML version deleted]] > >
check ?which.max(), e.g., x <- c(1,4,15,6,7) which.max(x) Best, Dimitris ---- Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm ----- Original Message ----- From: <croero at hotmail.com> To: <r-help at stat.math.ethz.ch> Sent: Wednesday, April 04, 2007 5:13 PM Subject: [R] argmax Hello, Is there any function that returns the argmax of a vector ? For example I have the vector x=(1,4,15,6,7) max(x)=15 I want a function f such that f(x)=3 because this is where max(x) is. Thank your very much. P.S. : I know it is a basic question but I have not figured it out by myself. _________________________________________________________________ ues clics pour retrouver tout ce qui vous int?resse au m?me endroit. [[alternative HTML version deleted]] --------------------------------------------------------------------------------> ______________________________________________ > R-help at 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. >Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
which.max(x) Il giorno mer, 04/04/2007 alle 15.13 +0000, croero at hotmail.com ha scritto:> Hello, > > Is there any function that returns the argmax of a vector ? > > For example I have the vector x=(1,4,15,6,7) > > max(x)=15 > > I want a function f such that f(x)=3 because this is where max(x) is. > > Thank your very much. > > P.S. : I know it is a basic question but I have not figured it out by myself. > _________________________________________________________________ > > ues clics pour retrouver tout ce qui vous intresse au mme endroit. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.