[R] Calculate across columns

timbean timbean at gmail.com
Tue Mar 17 01:56:54 CET 2009


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]). Unfortunately, doing so returns 36 columns. 

Thanks,
Tim
-- 
View this message in context: http://www.nabble.com/Calculate-across-columns-tp22549648p22549648.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list