summaryrefslogtreecommitdiff
path: root/R/idframe.R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-01-18 10:45:19 +0530
committerSuraj Yerramilli2015-01-18 10:45:19 +0530
commitaf1fcee01da6994b2d49b44142bc4829c8012e2c (patch)
tree48d2ab30913eed3fbee37360ce60031520371145 /R/idframe.R
parent41d42b00f7e86581ba23347cf38337d81e4d0101 (diff)
downloadSysID-R-code-af1fcee01da6994b2d49b44142bc4829c8012e2c.tar.gz
SysID-R-code-af1fcee01da6994b2d49b44142bc4829c8012e2c.tar.bz2
SysID-R-code-af1fcee01da6994b2d49b44142bc4829c8012e2c.zip
added input validation
Diffstat (limited to 'R/idframe.R')
-rw-r--r--R/idframe.R11
1 files changed, 9 insertions, 2 deletions
diff --git a/R/idframe.R b/R/idframe.R
index 0040629..8be4d67 100644
--- a/R/idframe.R
+++ b/R/idframe.R
@@ -5,6 +5,14 @@ idframe <- function(output=data.frame(numeric(0)),input=data.frame(numeric(0)),
t.start=0,t.end=NA, timeUnit = "seconds",
frequencies = NA, freqUnit= "Hz"){
+ ## Input Validation
+ if(!(type %in% c("time","freq"))) # type validation
+ stop("Unknown domain type")
+
+ if(dim(output)[1]!=dim(input)[1]) # observation validation
+ stop("Dimensions don't matach")
+
+ # Object Constructor
dat <- list(output=data.frame(output),input=data.frame(input),type=type,Ts=Ts)
n <- dim(output)[1]
p <- dim(output)[2];m <- dim(input)[2]
@@ -56,5 +64,4 @@ plot.idframe <- function(object,...){
# summary method for idframe object
summary.idframe <- function(object,...){
-}
-
+} \ No newline at end of file