[R] strange behavior of names<-
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Mon May 10 09:33:02 CEST 2004
"Liaw, Andy" <andy_liaw at merck.com> 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
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list