From 42e6b36e1b8f1648f3b2735f2b4092953d4d43a6 Mon Sep 17 00:00:00 2001 From: Suraj Yerramilli Date: Tue, 22 Mar 2016 16:06:37 +0530 Subject: support for centering data --- R/preprocess.R | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'R') diff --git a/R/preprocess.R b/R/preprocess.R index 36c4281..ad9df75 100644 --- a/R/preprocess.R +++ b/R/preprocess.R @@ -30,15 +30,19 @@ detrend <- function(x,type=0){ reg <- time(x) if(class(type)=="trendInfo"){ - tinfo = type + tinfo <- type } else if(type == 0){ tinfo <- trendInfo() if(nOutputSeries(x)!=0){ - + outputData(z) <- apply(outputData(x),2,scale,T,F) + tinfo$OutputOffset <- colMeans(z$output) + tinfo$OutputSlope <- t(rep(0,nOutputSeries(x))) } if(nInputSeries(x)!=0){ - + inputData(z) <- apply(inputData(x),2,scale,T,F) + tinfo$InputOffset <- colMeans(z$input) + tinfo$InputSlope <- t(rep(0,nInputSeries(x))) } } else if(type==1){ formula <- X ~ reg -- cgit