Re: [R] Calculate across columns

2009-03-17 Thread Tal Galili
try: apply(data[,c(6:42)], 2, max) (as stephen sefick Just mentioned...) On Tue, Mar 17, 2009 at 2:56 AM, timbean timb...@gmail.com wrote: I'd like to perform some calculations across a series of columns. Is there an easy way to do so? For example, I'd like to calculate the maximum

[R] Calculate across columns

2009-03-16 Thread timbean
I'd like to perform some calculations across a series of columns. Is there an easy way to do so? For example, I'd like to calculate the maximum value from columns 6-42. Although I can use, say: pmax(data[,6],data[,7],data[,8], etc.), I'd prefer to be able to do something like pmax(data[,6:42]).

Re: [R] Calculate across columns

2009-03-16 Thread stephen sefick
?apply look at the MARGIN argument On Mon, Mar 16, 2009 at 8:56 PM, timbean timb...@gmail.com wrote: I'd like to perform some calculations across a series of columns. Is there an easy way to do so? For example, I'd like to calculate the maximum value from columns 6-42. Although I can use,