summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-02-06 22:36:57 +0530
committerSuraj Yerramilli2015-02-06 22:36:57 +0530
commit42cd9b42fb05596cd1ed81935df79c885c7e02ad (patch)
tree34b398b038590be4f25b78a7b50727330c8dd8ba
parentc6e753162add6d331c665b629c71594bfd448693 (diff)
downloadSysID-R-code-42cd9b42fb05596cd1ed81935df79c885c7e02ad.tar.gz
SysID-R-code-42cd9b42fb05596cd1ed81935df79c885c7e02ad.tar.bz2
SysID-R-code-42cd9b42fb05596cd1ed81935df79c885c7e02ad.zip
corrected data splitting code
-rw-r--r--R/partition.R8
1 files 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