[R] mean and sd for a Dataframe

Ramya ramya.victory at gmail.com
Thu Feb 10 06:24:15 CET 2011


hi there,
I need to subtract each value in the dataframe from the mean of the column
and divide by the
standard deviation of the column.


> dim(a)
[1] 22011    52

data2 <- sapply(seq(from = 2, by = 1, length = 50), function(e){
rbind((a[[e]] - mean(a[,e]))/sd(a[,e]))
})

Does this look right????

Any help would be appreciated.

Thanks
RT


-- 
View this message in context: http://r.789695.n4.nabble.com/mean-and-sd-for-a-Dataframe-tp3298594p3298594.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list