From 42cd9b42fb05596cd1ed81935df79c885c7e02ad Mon Sep 17 00:00:00 2001 From: Suraj Yerramilli Date: Fri, 6 Feb 2015 22:36:57 +0530 Subject: corrected data splitting code --- R/partition.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/R/partition.R b/R/partition.R index 0b88f6c..ab9dba6 100644 --- a/R/partition.R +++ b/R/partition.R @@ -20,9 +20,11 @@ dataSlice <- function(object,indices){ if(trim$type=="freq"){ trim$frequncies <- trim$frequencies[indices] } else { - trim$t.start <- trim$t.start + Ts*(indices[1]-1) - trim$t.end <- trim$t.start + Ts*(length(indices)-1) + trim$t.start <- trim$t.start + trim$Ts*(indices[1]-1) + trim$t.end <- trim$t.start + trim$Ts*(length(indices)-1) } + + return(trim) } #' Split data into training and validation sets @@ -47,5 +49,5 @@ dataPartition <- function(object,p=0.6){ train <- dataSlice(object,trainIndex) test <- dataSlice(object,testIndex) - return(estimation=train,validation=test) + return(list(estimation=train,validation=test)) } \ No newline at end of file -- cgit