"Liaw, Andy" <[EMAIL PROTECTED]> writes:

> [BTW, this is using the tip that Thomas Lumley posted about forming the
> group means.  I've wanted to write a `tsweep' function that's sort of the
> cross of tapply() and sweep().]

Also notice that this is

unsplit(lapply(split(x, g), scale, scale=FALSE), g)

and the generalized sweep might be written along the lines of

unsplit(mapply("-",split(x,g),tapply(x,g,mean)),g)

Can't vouch for the speed, though.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to