Re: [R] mean and sd for a Dataframe

2011-02-09 Thread David Winsemius
On Feb 10, 2011, at 12:24 AM, Ramya wrote: 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] 2201152 data2 <- sapply(seq(from = 2, by = 1, length = 50), function(e){ rbind((a[[e]] - me

[R] mean and sd for a Dataframe

2011-02-09 Thread Ramya
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] 2201152 data2 <- sapply(seq(from = 2, by = 1, length = 50), function(e){ rbind((a[[e]] - mean(a[,e]))/sd(a[,e])) }) Does this look right