Re: [R] Aggregate, max and time of max

2009-07-24 Thread Carlos J. Gil Bellosta
Hello, I believe that by( data.ex, data.ex[,c(3,4)], function(x) x[which.max(x[,1]),] ) does what you want. Then, do.call( rbind, by( data.ex, data.ex[,c(3,4)], function(x) x[which.max(x[,1]),] ) ) looks somewhat nicer. Best regards, Carlos J. Gil Bellosta http://www.datanalytics.com On Fr

[R] Aggregate, max and time of max

2009-07-24 Thread Afshartous, David
All, For data consisting of serial measurements on subjects, one may use the aggregate function to say compute the peak response for each subject for each design condition. Is there a way to alter this or another one-liner to also retain the time at which the peak occurred and thus avoid writing