Re: [R] Utility function to apply a scale object on another data frame

2011-07-17 Thread E- Cognium
Thanks, Joshua. This is exactly what I was looking for. On Sat, Jul 16, 2011 at 11:17 AM, Joshua Wiley wrote: > > Hi "e", > > Here is a simple function to use the attributes from one scaled object > to scale another. > > > x = data.frame(a=1:10,b=11:20) > y = data.frame(a=2:11,b=12:21) > s <- sca

Re: [R] Utility function to apply a scale object on another data frame

2011-07-16 Thread Joshua Wiley
Hi "e", Here is a simple function to use the attributes from one scaled object to scale another. x = data.frame(a=1:10,b=11:20) y = data.frame(a=2:11,b=12:21) s <- scale(x) ## function to scale x using attributes from trained scale2 <- function(x, trained) { x <- as.matrix(x) x <- sweep(x,

Re: [R] Utility function to apply a scale object on another data frame

2011-07-16 Thread David Winsemius
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 f

[R] Utility function to apply a scale object on another data frame

2011-07-16 Thread E- Cognium
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 approa