On 7/23/07, Bertolt Meyer <[EMAIL PROTECTED]> wrote: > > And another question: Does anybody know whether it is possible to save > individual group-mean-centered values into a new variable?
If data is in 'x' and grouping factor is 'group', use "x - tapply(x, group, mean)[group]" For example: group <- gl(2,10) x <- rnorm(20) x - tapply(x, group, mean)[group] -- Christophe Pallier (http://www.pallier.org) [[alternative HTML version deleted]] ______________________________________________ [email protected] 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.
