[Pomp-commits] r832 - in pkg/pomp: inst/examples tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 10 21:58:03 CET 2013


Author: kingaa
Date: 2013-03-10 21:58:03 +0100 (Sun, 10 Mar 2013)
New Revision: 832

Modified:
   pkg/pomp/inst/examples/bbs.R
   pkg/pomp/inst/examples/blowflies.R
   pkg/pomp/inst/examples/euler.sir.R
   pkg/pomp/inst/examples/gillespie.sir.R
   pkg/pomp/inst/examples/gompertz.R
   pkg/pomp/inst/examples/ou2.R
   pkg/pomp/inst/examples/ricker.R
   pkg/pomp/inst/examples/rw2.R
   pkg/pomp/inst/examples/verhulst.R
   pkg/pomp/tests/filtfail.R
   pkg/pomp/tests/filtfail.Rout.save
Log:
- largely cosmetic streamlining


Modified: pkg/pomp/inst/examples/bbs.R
===================================================================
--- pkg/pomp/inst/examples/bbs.R	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/inst/examples/bbs.R	2013-03-10 20:58:03 UTC (rev 832)
@@ -1,6 +1,6 @@
 require(pomp)
 
-tc <- textConnection("
+flu <- read.csv2(text="
 day;reports
 1;3
 2;8
@@ -18,9 +18,6 @@
 14;5
 ")
 
-flu <- read.csv2(file=tc)
-close(tc)
-
 po <- pomp(
            data=flu,
            times="day",

Modified: pkg/pomp/inst/examples/blowflies.R
===================================================================
--- pkg/pomp/inst/examples/blowflies.R	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/inst/examples/blowflies.R	2013-03-10 20:58:03 UTC (rev 832)
@@ -868,14 +868,13 @@
 718;8103;4
 720;6803;4
 '
-
 raw.data <- subset(
-                   read.csv2(textConnection(blowfly.data),comment.char="#"),
-                   set==4
+                   read.csv2(text=blowfly.data,comment.char="#"),
+                   set==4,
+                   select=-set
                    )
-
 pomp(
-     data=subset(raw.data[c("day","y")],day>14&day<400),
+     data=subset(raw.data,day>14&day<400),
      times="day",
      t0=14,
      rprocess=discrete.time.sim(

Modified: pkg/pomp/inst/examples/euler.sir.R
===================================================================
--- pkg/pomp/inst/examples/euler.sir.R	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/inst/examples/euler.sir.R	2013-03-10 20:58:03 UTC (rev 832)
@@ -213,7 +213,7 @@
 
 
 po <- pomp(
-           data=read.csv2(textConnection(dat)),
+           data=read.csv2(text=dat),
            times="time",
            t0=0,
            params=c(

Modified: pkg/pomp/inst/examples/gillespie.sir.R
===================================================================
--- pkg/pomp/inst/examples/gillespie.sir.R	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/inst/examples/gillespie.sir.R	2013-03-10 20:58:03 UTC (rev 832)
@@ -525,7 +525,7 @@
 '
 
 pomp(
-     data=read.csv2(textConnection(dat)),
+     data=read.csv2(text=dat),
      times="time",
      t0=0,
      params=c(

Modified: pkg/pomp/inst/examples/gompertz.R
===================================================================
--- pkg/pomp/inst/examples/gompertz.R	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/inst/examples/gompertz.R	2013-03-10 20:58:03 UTC (rev 832)
@@ -105,7 +105,7 @@
 '
 
 po <- pomp(
-           data=read.csv2(textConnection(dat)),
+           data=read.csv2(text=dat),
            times="time",
            t0=0,
            params=c(K=1,r=0.1,sigma=0.1,tau=0.1,X.0=1),

Modified: pkg/pomp/inst/examples/ou2.R
===================================================================
--- pkg/pomp/inst/examples/ou2.R	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/inst/examples/ou2.R	2013-03-10 20:58:03 UTC (rev 832)
@@ -104,7 +104,7 @@
 '
 
 pomp( 
-     data=read.csv2(textConnection(dat)),
+     data=read.csv2(text=dat),
      times="time",
      t0=0,
      rprocess=discrete.time.sim("ou2_step",PACKAGE="pomp"),

Modified: pkg/pomp/inst/examples/ricker.R
===================================================================
--- pkg/pomp/inst/examples/ricker.R	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/inst/examples/ricker.R	2013-03-10 20:58:03 UTC (rev 832)
@@ -55,7 +55,7 @@
 '
 
 pomp(
-     data=read.csv2(textConnection(dat)),
+     data=read.csv2(text=dat),
      times="time",
      t0=0,
      params=c(r=exp(3.8),sigma=0.3,phi=10,N.0=7,e.0=0), # originally used to generate the data

Modified: pkg/pomp/inst/examples/rw2.R
===================================================================
--- pkg/pomp/inst/examples/rw2.R	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/inst/examples/rw2.R	2013-03-10 20:58:03 UTC (rev 832)
@@ -104,7 +104,7 @@
 '
 
 pomp(
-     data=read.csv2(textConnection(dat)),
+     data=read.csv2(text=dat),
      times="time",
      t0=0,
      params=c(x1.0=0,x2.0=0,s1=1,s2=3,tau=1), # parameters at which data were generated

Modified: pkg/pomp/inst/examples/verhulst.R
===================================================================
--- pkg/pomp/inst/examples/verhulst.R	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/inst/examples/verhulst.R	2013-03-10 20:58:03 UTC (rev 832)
@@ -1004,7 +1004,7 @@
 '
 
 pomp(
-     data=read.csv2(textConnection(dat)),
+     data=read.csv2(text=dat),
      times="time",
      t0=0,
      params=c(n.0=10000,K=10000,r=0.9,sigma=0.4,tau=0.1),

Modified: pkg/pomp/tests/filtfail.R
===================================================================
--- pkg/pomp/tests/filtfail.R	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/tests/filtfail.R	2013-03-10 20:58:03 UTC (rev 832)
@@ -5,7 +5,8 @@
 ### the following example tests to make sure that states are updated properly
 ### upon filtering failures
 
-"time,admissions,discharges,patients,cases
+records <- read.csv(text="
+time,admissions,discharges,patients,cases
 0,4,2,8,
 1,0,1,10,2
 2,2,0,9,1
@@ -27,12 +28,8 @@
 18,4,0,7,1
 19,0,0,11,0
 20,1,4,11,
-" -> csvtext
+")
 
-tc <- textConnection(csvtext)
-records <- read.csv(tc)
-close(tc)
-
 po <- pomp(
            data=subset(records[c("time","cases")],!is.na(cases)),
            times="time",

Modified: pkg/pomp/tests/filtfail.Rout.save
===================================================================
--- pkg/pomp/tests/filtfail.Rout.save	2013-03-10 20:49:19 UTC (rev 831)
+++ pkg/pomp/tests/filtfail.Rout.save	2013-03-10 20:58:03 UTC (rev 832)
@@ -1,6 +1,6 @@
 
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
+R version 2.15.3 (2013-03-01) -- "Security Blanket"
+Copyright (C) 2013 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
@@ -26,7 +26,8 @@
 > ### the following example tests to make sure that states are updated properly
 > ### upon filtering failures
 > 
-> "time,admissions,discharges,patients,cases
+> records <- read.csv(text="
++ time,admissions,discharges,patients,cases
 + 0,4,2,8,
 + 1,0,1,10,2
 + 2,2,0,9,1
@@ -48,12 +49,8 @@
 + 18,4,0,7,1
 + 19,0,0,11,0
 + 20,1,4,11,
-+ " -> csvtext
++ ")
 > 
-> tc <- textConnection(csvtext)
-> records <- read.csv(tc)
-> close(tc)
-> 
 > po <- pomp(
 +            data=subset(records[c("time","cases")],!is.na(cases)),
 +            times="time",
@@ -121,4 +118,4 @@
 > 
 > proc.time()
    user  system elapsed 
-  0.456   0.052   0.526 
+  0.464   0.044   0.524 



More information about the pomp-commits mailing list