[Pomp-commits] r1065 - pkg/pomp/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jan 31 16:59:25 CET 2015


Author: kingaa
Date: 2015-01-31 16:59:25 +0100 (Sat, 31 Jan 2015)
New Revision: 1065

Modified:
   pkg/pomp/R/builder.R
Log:
- small change to the way 'pompCBuilder' picks the name of the file

Modified: pkg/pomp/R/builder.R
===================================================================
--- pkg/pomp/R/builder.R	2015-01-29 12:08:31 UTC (rev 1064)
+++ pkg/pomp/R/builder.R	2015-01-31 15:59:25 UTC (rev 1065)
@@ -172,23 +172,27 @@
   paste0("  error(\"'",name,"' not defined\");")
 }
 
-pompCBuilder <- function (name, statenames, paramnames, covarnames, obsnames,
+randomName <- function (stem = "pomp", size = 2) {
+  paste0(stem,
+         paste(
+               format(
+                      as.hexmode(ceiling(runif(n=size,max=2^24))),
+                      upper.case=TRUE
+                      ),
+               collapse=""
+               )
+         )
+}
+
+pompCBuilder <- function (name = NULL,
+                          statenames, paramnames, covarnames, obsnames,
                           rmeasure, dmeasure, step.fn, skeleton,
                           parameter.transform, parameter.inv.transform,
                           rprior, dprior, globals, save = FALSE, link = TRUE,
                           verbose = getOption("verbose",FALSE))
 {
 
-  if (missing(name))
-    name <- paste0("pomp",
-                   paste(
-                         format(
-                                as.hexmode(ceiling(runif(n=2,max=2^24))),
-                                upper.case=TRUE
-                                ),
-                         collapse=""
-                         )
-                   )
+  if (is.null(name)) name <- randomName()
 
   has.trans <- !(missing(parameter.transform))
 



More information about the pomp-commits mailing list