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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: sts-class
> ### Title: Class '"sts"' - surveillance time series
> ### Aliases: sts sts-class alarms,sts-method alarms<-,sts-method
> ###   upperbound,sts-method upperbound<-,sts-method control,sts-method
> ###   control<-,sts-method epoch,sts-method epoch<-,sts-method
> ###   observed,sts-method observed<-,sts-method population,sts-method
> ###   population<-,sts-method multinomialTS,sts-method
> ###   multinomialTS<-,sts-method neighbourhood,sts-method
> ###   neighbourhood<-,sts-method dim,sts-method dimnames,sts-method
> ###   epochInYear epochInYear,sts-method year year,sts-method
> ###   initialize,sts-method as.data.frame,sts-method coerce,sts,ts-method
> ###   coerce,ts,sts-method as.xts.sts
> ### Keywords: classes
> 
> ### ** Examples
> 
> ## A typical dataset with weekly counts of measles from several districts
> data("measlesWeserEms")
> measlesWeserEms
-- An object of class sts -- 
freq:		 52 
start:		 2001 1 
dim(observed):	 104 17 

Head of observed:
     03401 03402 03403 03404 03405 03451 03452 03453 03454 03455 03456 03457
[1,]     0     0     0     0     0     0     0     0     0     0     0     0
     03458 03459 03460 03461 03462
[1,]     0     0     0     0     0

map:
Object of class SpatialPolygonsDataFrame
Coordinates:
       min       max
x  6.65464  8.711123
y 52.03746 53.788426
Is projected: FALSE 
proj4string :
[+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0]
Features    : 17 
Data slot   : 6 variables

head of neighbourhood:
      03401 03402 03403 03404 03405 03451 03452 03453 03454 03455 03456 03457
03401     0     4     2     4     3     2     4     2     3     2     4     3
      03458 03459 03460 03461 03462
03401     1     3     2     1     3
> 
> ## reconstruct data("measlesWeserEms") from its components
> counts <- observed(measlesWeserEms)
> map <- measlesWeserEms@map
> populationFrac <- population(measlesWeserEms)
> weserems_nbOrder <- neighbourhood(measlesWeserEms)
> ## orders of adjacency can also be determined from the map
> if (requireNamespace("spdep")) {
+     stopifnot(identical(weserems_nbOrder,
+                         nbOrder(poly2adjmat(map), maxlag = 10)))
+ }
Note: range of maximum neighbour order by region is 3-5
> mymeasles <- sts(counts, start = c(2001, 1), frequency = 52,
+                  population = populationFrac,
+                  neighbourhood = weserems_nbOrder, map = map)
> stopifnot(identical(mymeasles, measlesWeserEms))
> 
> ## convert ts/mts object to sts
> z <- ts(matrix(rpois(300,10), 100, 3), start = c(1961, 1), frequency = 12)
> z.sts <- as(z, "sts")
> plot(z.sts)
> 
> ## conversion of "sts" objects to the quasi-standard "xts" class
> if (require("xts")) {
+     z.xts <- as.xts(z.sts)
+     plot(z.xts)
+ }
Loading required package: xts
Loading required package: zoo

Attaching package: ‘zoo’

The following objects are masked from ‘package:base’:

    as.Date, as.Date.numeric

Registered S3 method overwritten by 'xts':
  method     from
  as.zoo.xts zoo 
Error in UseMethod("as.xts") : 
  no applicable method for 'as.xts' applied to an object of class "sts"
Calls: as.xts
Execution halted