Peter Dalgaard wrote:
> Alternatively, rewrite aggregate() and send us a patch ;-)
>
> It is not necessarily all that hard. Here's a rough idea
>
> IX <- as.data.frame(by)
> OO <- do.call(order,IX)
> Y <- x[OO,]
> g <- cumsum(!duplicated(IX))
> FF <- unique(IX)
> cbind(FF, sapply(split(x,g),FUN))
>
> (completely untested, of course, and if it works, it works only for a
> single-column x; otherwise, you need a loop over the columns somehow.
>   
I see two glaring blunders already...

You need IX[OO,] in two places, and split(Y, g) not x

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch 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 commented, minimal, self-contained, reproducible code.

Reply via email to