[Pomp-commits] r285 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 6 19:47:13 CEST 2010


Author: kingaa
Date: 2010-07-06 19:47:12 +0200 (Tue, 06 Jul 2010)
New Revision: 285

Modified:
   pkg/R/pomp-methods.R
Log:
- error checking in 'data.array'


Modified: pkg/R/pomp-methods.R
===================================================================
--- pkg/R/pomp-methods.R	2010-07-06 12:46:49 UTC (rev 284)
+++ pkg/R/pomp-methods.R	2010-07-06 17:47:12 UTC (rev 285)
@@ -30,8 +30,11 @@
           "data.array",
           "pomp",
           function (object, vars, ...) {
+            varnames <- rownames(object at data)
             if (missing(vars))
-              vars <- seq(length=nrow(object at data))
+              vars <- varnames
+            else if (!all(vars%in%varnames))
+              stop("some elements of ",sQuote("vars")," correspond to no observed variable")
             object at data[vars,,drop=FALSE]
           }
           )



More information about the pomp-commits mailing list