Re: [R] the problem about normalize the data frame

2009-08-12 Thread Tal Galili
Hi Gina. I am not sure your normalization process does what you want, but just to get the code working, here is how it can be done: # example data my.data <- data.frame(rnorm(100,3,4), rnorm(100,3,4)) bb<-function(dat) { (dat-min(dat))/(max(dat)-min(dat)) } dat1<-t(apply(my.data,1,bb)) Bes

[R] the problem about normalize the data frame

2009-08-12 Thread Gina Liao
Hello, I'd like to normalize a data frame which are "45000 obs. of 212 variables".I want to normalize the data frame by each row. But I failed.Here is my R code, can you tell me where am I wrong? > bb<-function(normalize) (dat[i,]-min(dat[i,]))/(max(dat[i,])-min(dat[i,]))> dat1<-apply(dat,1,b