On Jul 16, 2011, at 4:08 AM, E- Cognium wrote:

Hi Everyone,

I would like to scale a data frame and then using the same scaling
parameters scale on another data frame. This will be helpful in scaling the test dataset based on train dataset's scaling parameters. I couldn't find any utility functions that do this. Any suggestions on how to approach this
problem?

x = data.frame(a=1:10,b=11:20)
y = data.frame(a=2:11,b=12:21)
s <- scale(x)
###
### would like scale 'y' using the parameters contained in 's'

Just look at s and consult the obvious help page...
?attr

attr(s,"scaled:center")
attr(s,"scaled:scale")

--
David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to