Re: [Rd] Suggestion to extend aggregate() to return multiple and/or named values

2007-07-13 Thread Gabor Grothendieck
Note that it does not work in this case: > aggregate(CO2[4:5], CO2[1:2], mean) PlantType conc uptake 1Qn1 Quebec 435 33.22857 2Qn2 Quebec 435 35.15714 3Qn3 Quebec 435 37.61429 4Qc1 Quebec 435 29.97143 5Qc3 Quebec 435 32.58571 6Qc2

Re: [Rd] Suggestion to extend aggregate() to return multiple and/or named values

2007-07-13 Thread Mike Lawrence
bugfix already :P prior version fails when there is only one factor in Ind. This version also might be faster as I avoid using aggregate to create the dummy frame. agg=function(z,Ind,FUN,...){ FUN.out=by(z,Ind,FUN,...) num.cells=length(FUN.out) num.values=length(FUN.out

Re: [Rd] Suggestion to extend aggregate() to return multiple and/or named values

2007-07-13 Thread Gabor Grothendieck
Note that summaryBy in the doBy package can also do that. library(doBy) DF <- data.frame(z, A = Ind$A, B = Ind$B) summaryBy(z ~ A + B, DF, FUN = summary) summaryBy(z ~ A + B, DF, FUN = summary2) On 7/13/07, Mike Lawrence <[EMAIL PROTECTED]> wrote: > Hi all, > > This is my first post to the develo

[Rd] Suggestion to extend aggregate() to return multiple and/or named values

2007-07-13 Thread Mike Lawrence
Hi all, This is my first post to the developers list. As I understand it, aggregate() currently repeats a function across cells in a dataframe but is only able to handle functions with single value returns. Aggregate() also lacks the ability to retain the names given to the returned value.