[R] finding index of maximum value in vector

Kjetil Brinchmann Halvorsen kjetilbrinchmannhalvorsen at gmail.com
Sun Dec 18 20:37:22 CET 2005


Jean-Luc Fontaine wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I found:
>   max.col(matrix(c(1,3,2),nrow=1))
> Is there a more concise/elegant way?

which.max

> Thanks,
> 
> - --
> Jean-Luc Fontaine  http://jfontain.free.fr/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
> 
> iD8DBQFDpbfAkG/MMvcT1qQRAjGnAJsH+9MWuiv+K+US0McW2fLzRx2LHwCfYpNG
> gWKLuxnnlNde8WEr7wU5NUM=
> =7/gr
> -----END PGP SIGNATURE-----
> 
> ______________________________________________
> 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
>




More information about the R-help mailing list