Re: [R] Learning to speak R: simple data processing

2013-01-11 Thread Greg Snow
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

Re: [R] Learning to speak R: simple data processing

2013-01-11 Thread ej
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

Re: [R] Learning to speak R: simple data processing

2013-01-10 Thread C.H.
?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

[R] Learning to speak R: simple data processing

2013-01-10 Thread ej
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