The apply function takes another function as the argument to be applied to
each row (or column) of the matrix. You can use an existing function like
you did with 'max' and in this case there is an existing function called
'which.max' that does exactly what you want. If there is not an existing
fu
Ah! Very nice. Thank you, Arun!
--
View this message in context:
http://r.789695.n4.nabble.com/Learning-to-speak-R-simple-data-processing-tp4655194p4655237.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing
?which.max
On Fri, Jan 11, 2013 at 7:59 AM, ej wrote:
> apply(m, 1, max)
__
R-help@r-project.org 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 comment
So, I am just trying to learn R...
Here is a rather contrived example that would be pretty obvious to me in
terms of writing code to loop through elements, but the slick, fast, compact
way of expressing this in R is not obvious to me.
Here's code to generate a simple matrix of data:
> m <- floor
4 matches
Mail list logo