summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--R/preprocess.R10
1 files changed, 6 insertions, 4 deletions
diff --git a/R/preprocess.R b/R/preprocess.R
index 8d39707..be3c496 100644
--- a/R/preprocess.R
+++ b/R/preprocess.R
@@ -75,8 +75,8 @@ detrend <- function(data,type=c("constant","linear")[1]){
#'
#' @examples
#' data(cstr)
-#' train <- dataSlice(cstr,end=5000) # subset the first 5000 indices
-#' test <- dataSlice(cstr,start=6001) # subset from index 6001 till the end
+#' train <- dataSlice(cstr,end=5000)
+#' test <- dataSlice(cstr,start=6001)
#' fit <- detrend(train)
#' Ztrain <- predict(fit)
#' Ztest <- predict(fit,test)
@@ -177,12 +177,14 @@ dataSlice <- function(data,start=NULL,end=NULL,freq=NULL){
stop("Not an idframe data")
if(nOutputSeries(data)!=0)
+ if(!is.null(freq)) freq*frequency(data)
outputData(data) <- window(outputData(data),start=start,end=end,
- frequency=freq*frequency(data))
+ frequency=freq)
if(nInputSeries(data)!=0)
+ if(!is.null(freq)) freq*frequency(data)
inputData(data) <- window(inputData(data),start=start,end=end,
- frequency=freq*frequency(data))
+ frequency=freq)
return(data)
} \ No newline at end of file