great, thank you!
On 20.01.2012, at 18:10, R. Michael Weylandt wrote: > ? scale > apply(x, 2, scale) > > Michael > > On Fri, Jan 20, 2012 at 12:04 PM, Martin Batholdy > <batho...@googlemail.com> wrote: >> Hi, >> >> >> I am currently trying to z-transform (that is subtracting the mean and >> divide by the standard deviation) multiple columns of a data.frame at the >> same time. >> >> >> My first approach was: >> >> x <- data.frame(c(0:10), c(10:20)) >> (x - colMeans(x)) / apply(x, 2, sd) >> >> >> This is obviously not working. >> >> Is there a convenient way to z-transform each column separately (so in this >> case, each column represents an independent variable that should be >> z-transformed) >> >> >> thanks! >> ______________________________________________ >> R-help@r-project.org 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. ______________________________________________ R-help@r-project.org 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.