[R] Scaling on a data.frame
Stefan Roepcke
stefan.roepcke at metagen.de
Tue Jun 4 11:07:54 CEST 2002
Hey,
hopefully there is an easy way to solve my problem.
All that i think off is lengthy and clumsy.
Given a data.frame d with columns VALUE, FAC1, FAC2, FAC3.
Let FAC1 be something like experiment number,
so that there are exactly the same number of rows for each level of FAC1
in the data.frame.
Now i would like to scale all values according to the center of its
experiment.
So i can apply s <- by(d[1], FAC1, scale).
But i don't want to lose the binding to the other factors (FAC2, FAC3).
Or can i only control it via order preserving - it seems unsave.
Something like that would be nice:
"by(d[1], FAC1) <- by(d[1], FAC1, scale)"
Thanks, Stefan.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list