Running examples in ‘surveillance-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: epidataCS
> ### Title: Continuous Space-Time Marked Point Patterns with Grid-Based
> ###   Covariates
> ### Aliases: epidataCS as.epidataCS print.epidataCS nobs.epidataCS
> ###   head.epidataCS tail.epidataCS [.epidataCS subset.epidataCS
> ###   marks.epidataCS summary.epidataCS print.summary.epidataCS
> ###   as.stepfun.epidataCS getSourceDists
> ###   coerce,epidataCS,SpatialPointsDataFrame-method
> ### Keywords: spatial classes manip
> 
> ### ** Examples
> 
> ## load "imdepi" example data (which is an object of class "epidataCS")
> data("imdepi")
> 
> ## print and summary
> print(imdepi, n=5, digits=2)
Observation period: 0 - 2557 
Observation window (bounding box): [4031, 4672] x [2684, 3550] 
Spatio-temporal grid (not shown): 84 time blocks x 413 tiles 
Types of events: "B" "C"
Overall number of events: 636

   coordinates  time  tile type eps.t eps.s    sex   agegrp BLOCK start
1 (4100, 3200)  0.21 05554    B    30   200   male   [3,19)     1     0
2 (4100, 3100)  0.71 05382    C    30   200   male   [3,19)     1     0
3 (4400, 2900)  5.59 09574    B    30   200 female [19,Inf)     1     0
4 (4200, 2900)  7.12 08212    B    30   200 female   [3,19)     1     0
5 (4100, 3200) 22.06 05554    C    30   200   male   [3,19)     1     0
  popdensity
1        261
2        519
3        209
4       1666
5        261
[....]
> print(s <- summary(imdepi))
Observation period: 0 - 2557 
Observation window (bounding box): [4031.295, 4672.253] x [2684.102, 3549.931] 
Spatio-temporal grid (not shown): 84 time blocks x 413 tiles 
Overall number of events: 636 (2 types)

Summary of event marks and number of potential sources:
      time                tile     type        eps.t        eps.s    
 Min.   :   0.2117   05354  : 34   B:336   Min.   :30   Min.   :200  
 1st Qu.: 539.4753   05370  : 27   C:300   1st Qu.:30   1st Qu.:200  
 Median :1154.9527   11000  : 27           Median :30   Median :200  
 Mean   :1192.6813   05358  : 13           Mean   :30   Mean   :200  
 3rd Qu.:1808.0295   05162  : 12           3rd Qu.:30   3rd Qu.:200  
 Max.   :2542.7800   05382  : 12           Max.   :30   Max.   :200  
                     (Other):511                                     
     sex           agegrp          x              y          |.sources|    
 female:292   [0,3)   :194   Min.   :4039   Min.   :2710   Min.   : 0.000  
 male  :339   [3,19)  :279   1st Qu.:4101   1st Qu.:2967   1st Qu.: 0.000  
 NA's  :  5   [19,Inf):162   Median :4206   Median :3106   Median : 1.000  
              NA's    :  1   Mean   :4244   Mean   :3092   Mean   : 1.634  
                             3rd Qu.:4361   3rd Qu.:3194   3rd Qu.: 2.000  
                             Max.   :4665   Max.   :3525   Max.   :14.000  
                                                                           
> plot(s$counter,  # same as 'as.stepfun(imdepi)'
+      xlab = "Time [days]", ylab="Number of infectious individuals",
+      main=paste("Time course of the number of infectious individuals",
+                 "assuming an infectious period of 30 days", sep="\n"))
> plot(table(s$nSources), xlab="Number of \"close\" infective individuals",
+      ylab="Number of events",
+      main=paste("Distribution of the number of potential sources",
+                 "assuming an interaction range of 200 km and 30 days",
+                 sep="\n"))
> ## the summary object contains further information
> str(s)
List of 14
 $ timeRange  : num [1:2] 0 2557
 $ bbox       : num [1:2, 1:2] 4031 2684 4672 3550
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:2] "x" "y"
  .. ..$ : chr [1:2] "min" "max"
 $ nBlocks    : int 84
 $ nEvents    : int 636
 $ nTypes     : int 2
 $ eventTimes : num [1:636] 0.212 0.712 5.591 7.117 22.06 ...
 $ eventCoords: num [1:636, 1:2] 4112 4123 4412 4203 4128 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:636] "1" "2" "3" "4" ...
  .. ..$ : chr [1:2] "x" "y"
 $ eventTypes : Factor w/ 2 levels "B","C": 1 2 1 1 2 2 2 2 2 2 ...
 $ eventRanges:'data.frame':	636 obs. of  2 variables:
  ..$ eps.t: num [1:636] 30 30 30 30 30 30 30 30 30 30 ...
  ..$ eps.s: num [1:636] 200 200 200 200 200 200 200 200 200 200 ...
 $ eventMarks :'data.frame':	636 obs. of  9 variables:
  ..$ time  : num [1:636] 0.212 0.712 5.591 7.117 22.06 ...
  ..$ tile  : Factor w/ 413 levels "01001","01002",..: 95 91 291 195 95 79 94 327 289 5 ...
  ..$ type  : Factor w/ 2 levels "B","C": 1 2 1 1 2 2 2 2 2 2 ...
  ..$ eps.t : num [1:636] 30 30 30 30 30 30 30 30 30 30 ...
  ..$ eps.s : num [1:636] 200 200 200 200 200 200 200 200 200 200 ...
  ..$ sex   : Factor w/ 2 levels "female","male": 2 2 1 1 2 2 2 1 2 NA ...
  ..$ agegrp: Factor w/ 3 levels "[0,3)","[3,19)",..: 2 2 3 2 2 2 2 2 3 1 ...
  ..$ x     : num [1:636] 4112 4123 4412 4203 4128 ...
  ..$ y     : num [1:636] 3203 3077 2916 2880 3223 ...
 $ tileTable  : Named int [1:413] 2 2 2 2 2 1 0 0 1 0 ...
  ..- attr(*, "names")= chr [1:413] "01001" "01002" "01003" "01004" ...
 $ typeTable  : Named int [1:2] 336 300
  ..- attr(*, "names")= chr [1:2] "B" "C"
 $ counter    :function (v)  
  ..- attr(*, "class")= chr [1:2] "stepfun" "function"
  ..- attr(*, "call")= language stepfun(tps, c(0, nInfectious), right = TRUE)
 $ nSources   : int [1:636] 0 0 0 0 1 2 2 0 0 0 ...
 - attr(*, "class")= chr "summary.epidataCS"
> 
> ## a histogram of the spatial distances to potential source events
> ## (i.e., to events of the previous eps.t=30 days within eps.s=200 km)
> sourceDists_space <- getSourceDists(imdepi, "space")
> hist(sourceDists_space); rug(sourceDists_space)
> 
> ## internal structure of an "epidataCS"-object
> str(imdepi, max.level=4)
List of 4
 $ events :Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
  .. ..@ data       :'data.frame':	636 obs. of  14 variables:
  .. .. ..$ time            : num [1:636] 0.212 0.712 5.591 7.117 22.06 ...
  .. .. ..$ tile            : Factor w/ 413 levels "01001","01002",..: 95 91 291 195 95 79 94 327 289 5 ...
  .. .. ..$ type            : Factor w/ 2 levels "B","C": 1 2 1 1 2 2 2 2 2 2 ...
  .. .. ..$ eps.t           : num [1:636] 30 30 30 30 30 30 30 30 30 30 ...
  .. .. ..$ eps.s           : num [1:636] 200 200 200 200 200 200 200 200 200 200 ...
  .. .. ..$ sex             : Factor w/ 2 levels "female","male": 2 2 1 1 2 2 2 1 2 NA ...
  .. .. ..$ agegrp          : Factor w/ 3 levels "[0,3)","[3,19)",..: 2 2 3 2 2 2 2 2 3 1 ...
  .. .. ..$ BLOCK           : int [1:636] 1 1 1 1 1 1 2 2 2 2 ...
  .. .. ..$ start           : num [1:636] 0 0 0 0 0 0 31 31 31 31 ...
  .. .. ..$ popdensity      : num [1:636] 261 519 209 1666 261 ...
  .. .. ..$ .obsInfLength   : num [1:636] 30 30 30 30 30 30 30 30 30 30 ...
  .. .. ..$ .sources        :List of 636
  .. .. ..$ .bdist          : num [1:636] 13.2 66.6 94.4 12.4 19.2 ...
  .. .. ..$ .influenceRegion:List of 636
  .. .. .. ..- attr(*, "nCircle2Poly")= int 16
  .. .. .. ..- attr(*, "clipper")= chr "polyclip"
  .. ..@ coords.nrs : num(0) 
  .. ..@ coords     : num [1:636, 1:2] 4112 4123 4412 4203 4128 ...
  .. .. ..- attr(*, "dimnames")=List of 2
  .. ..@ bbox       : num [1:2, 1:2] 4039 2710 4665 3525
  .. .. ..- attr(*, "dimnames")=List of 2
  .. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
 $ stgrid :'data.frame':	34692 obs. of  6 variables:
  ..$ BLOCK     : int [1:34692] 1 1 1 1 1 1 1 1 1 1 ...
  ..$ start     : num [1:34692] 0 0 0 0 0 0 0 0 0 0 ...
  ..$ stop      : num [1:34692] 31 31 31 31 31 31 31 31 31 31 ...
  ..$ tile      : Factor w/ 413 levels "01001","01002",..: 1 2 3 4 5 6 7 8 9 10 ...
  ..$ area      : num [1:34692] 56.4 118.7 214.2 71.6 1428 ...
  ..$ popdensity: num [1:34692] 1557.1 1996.6 987.6 1083.3 95.6 ...
 $ W      :Formal class 'SpatialPolygons' [package "sp"] with 4 slots
  .. ..@ polygons   :List of 1
  .. .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
  .. ..@ plotOrder  : int 1
  .. ..@ bbox       : num [1:2, 1:2] 4031 2684 4672 3550
  .. .. ..- attr(*, "dimnames")=List of 2
  .. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
 $ qmatrix: logi [1:2, 1:2] TRUE FALSE FALSE TRUE
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:2] "B" "C"
  .. ..$ : chr [1:2] "B" "C"
 - attr(*, "class")= chr "epidataCS"
> ## see help("imdepi") for more info on the data set
> 
> ## extraction methods subset the 'events' component
> ## (thereby taking care of the validity of the epidataCS object,
> ## for instance the hidden auxiliary column .sources)
> imdepi[101:200,]
Observation period: 0 - 2557 
Observation window (bounding box): [4031.295, 4672.253] x [2684.102, 3549.931] 
Spatio-temporal grid (not shown): 84 time blocks x 413 tiles 
Types of events: "B" "C"
Overall number of events: 100

             coordinates     time  tile type eps.t eps.s    sex   agegrp BLOCK
101 (4052.863, 3096.593) 353.4000 05354    B    30   200 female [19,Inf)    12
102 (4556.355, 3262.682) 357.6672 11000    B    30   200   male   [3,19)    12
103 (4141.513, 3157.541) 358.5114 05913    C    30   200 female   [3,19)    12
104 (4417.974, 2759.005) 360.0455 09188    C    30   200 female    [0,3)    12
105 (4442.943, 2793.727) 363.5171 09184    C    30   200   male    [0,3)    12
106 (4072.581, 3119.168) 364.1096 05116    C    30   200   male    [0,3)    12
    start popdensity
101   334   567.2927
102   334  3834.0946
103   334  2093.0388
104   334   265.3942
105   334   472.7581
106   334  1525.4796
[....]
> tail(imdepi, n=4)           # reduce the epidemic to the last 4 events
Error in .tailindices(x, n) : could not find function ".tailindices"
Calls: tail -> tail.epidataCS -> my.tail.matrix
Execution halted