[R] Alternative to Scale Function?

Noah Silverman noah at smartmediacorp.com
Fri Sep 11 22:10:57 CEST 2009


Hi,

Is there an alternative to the scale function where I can specify my own 
mean and standard deviation?

I've come across an interesting issue where this would help.

I'm training and testing on completely different sets of data.  The 
testing set is smaller than the training set.

Using the standard scale function of R seems to introduce some error.  
Since it scales data WITHIN the set, it may scale the same number to 
different value since the range in the training and testing set may be 
different.

My thought was to scale the larger training set of data, then use the 
mean and SD of the training data to scale the testing data according to 
the same parameters.  That way a number will transform to the same 
result regardless of whether it is in the training or testing set.

I can't be the first one to have looked at this.  Does anyone know of a 
function in R or if there is a scale alternative where I can control the 
parameters?

Thanks!

--
Noah




More information about the R-help mailing list