Sunday 15 February 2015

Normalize data with its row mean in R -


I'm going through some difficulty after trying to divide each element in any line from that line . A dummy set of data:

  set.seed (1) x  

I thought it could be used:

  x / rowmeans (x)   

but I get an error Error: 'x' should be numeric

I think this error is due to the format of the data:

Because it is a data frame and no vector However, by changing the format of the data, being able to calculate the mean per line:

  Library (Data Eligible) xT <- as.data.table (x) xT [, List (mean = line man (sd)), = by plant   

From there, I'm not sure where to go I'm thinking that a loop will work, but some Looking at the discoveries, I know that he has not been advised, so I'm normalized for each sample plant. Any suggestion please?

First error Try to take the mean with the plant Try coming from variable / column, which is non-numeric:

  cbind (x $ plant, x [, - 1] / line meter (x [, - 1]))    

No comments:

Post a Comment