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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: echebin
> ### Title: Echelon spatial scan statistic based on Binomial model
> ### Aliases: echebin
> ### Keywords: echelon analysis spatial scan statistic spatial cluster
> ###   deteciotn
> 
> ### ** Examples
> 
> ##Hotspot detection for non-white birth in North Carolina using echelon scan
> 
> #Load required packages and data
> library(spData)
To access larger datasets in this package, install the spDataLarge
package with: `install.packages('spDataLarge',
repos='https://nowosad.github.io/drat/', type='source')`
> data("nc.sids")
> 
> #Non-white birth from 1974 to 1984 (case data)
> nwb <- nc.sids$NWBIR74 + nc.sids$NWBIR79
> 
> #White birth from 1974 to 1984 (control data)
> wb <- (nc.sids$BIR74 - nc.sids$NWBIR74) + (nc.sids$BIR79 - nc.sids$NWBIR79)
> 
> ##Hotspot detection based on Binomial model
> #Echelon analysis
> SIDS.echelon <- echelon(x = nwb/wb, nb = ncCR85.nb, name = row.names(nc.sids))
19 echelons are created
See the objects 'Table' and 'Echelons' for more details

> 
> #Basic cluster detection (significance not evaluated)
> SIDS.clusters <- echebin(SIDS.echelon, cas = nwb, ctl = wb, K = 20,
+   n.sim = 0, cluster.info = TRUE, main = "Hgih rate clusters", ens = FALSE)
dev.new(): using pdf(file="Rplots1.pdf")
------------- CLUSTERS DETECTED -------------
Number of locations ......: 100 region
Limit length of cluster ..: 20 regions
Total cases ..............: 240380
Total population .........: 752354
Scan for Area with .......: High Rates
Number of Replications ...: 0
Model ....................: Binomial

---------------------------------------------
MOST LIKELY CLUSTER -- 20 regions
 Cluster regions included : Halifax, Gates, Edgecombe, Martin, Washington, Vance, Chowan, Granville, Franklin, Greene, Lenoir, Northampton, Bertie, Hertford, Warren, Wilson, Jones, Pitt, Durham, Perquimans
 Population ..............: 98424
 Number of cases .........: 54019
 Expected cases ..........: 31446.847
 Observed / expected .....: 1.7178
 Relative risk ...........: 1.9258
 Log likelihood ratio ....: 12804.6298

----------------------------------------------
SECONDARY CLUSTERS
2 -- 3 regions
 Cluster regions included : Robeson, Hoke, Scotland
 Population ..............: 25048
 Number of cases .........: 17604
 Expected cases ..........: 8002.9324
 Observed / expected .....: 2.1997
 Relative risk ...........: 2.2945
 Log likelihood ratio ....: 8004.2121

3 -- 1 regions
 Cluster regions included : Anson
 Population ..............: 3445
 Number of cases .........: 2113
 Expected cases ..........: 1100.6908
 Observed / expected .....: 1.9197
 Relative risk ...........: 1.9279
 Log likelihood ratio ....: 628.1941

4 -- 1 regions
 Cluster regions included : Mecklenburg
 Population ..............: 52345
 Number of cases .........: 19658
 Expected cases ..........: 16724.4291
 Observed / expected .....: 1.1754
 Relative risk ...........: 1.191
 Log likelihood ratio ....: 396.0322

5 -- 1 regions
 Cluster regions included : Caswell
 Population ..............: 2288
 Number of cases .........: 1147
 Expected cases ..........: 731.0248
 Observed / expected .....: 1.569
 Relative risk ...........: 1.5718
 Log likelihood ratio ....: 162.5374

----------------------------------------------
Display only the top 5 clusters. See object 'clusters' for more details

> text(SIDS.echelon$coord, labels = SIDS.echelon$regions.name,
+   adj = -0.1, cex = 0.7)
> 
> #Detected clusters and neighbors map
> #XY coordinates of each polygon centroid point
> NC.coo <- cbind(nc.sids$lon, nc.sids$lat)
> echebin(SIDS.echelon, cas = nwb, ctl = wb, K = 20,
+   n.sim = 0, coo = NC.coo, dendrogram = FALSE)
dev.new(): using pdf(file="Rplots2.pdf")
MOST LIKELY CLUSTER -- 20 regions
 Cluster regions included : Halifax, Gates, Edgecombe, Martin, Washington, Vance, Chowan, Granville, Franklin, Greene, Lenoir, Northampton, Bertie, Hertford, Warren, Wilson, Jones, Pitt, Durham, Perquimans
 Population ..............: 98424
 Number of cases .........: 54019
 Expected cases ..........: 31446.847
 Observed / expected .....: 1.7178
 Relative risk ...........: 1.9258
 Log likelihood ratio ....: 12804.6298

> 
> #Load geospatial information for North Carolina
> nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"))
Reading layer `nc' from data source 
  `/home/hornik/tmp/R.check/r-patched-gcc/Work/build/Packages/sf/shape/nc.shp' 
  using driver `ESRI Shapefile'
Simple feature collection with 100 features and 14 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
Geodetic CRS:  NAD27
> 
> #Extract detected clusters
> MLC <- SIDS.clusters$clusters[[1]]
> Secondary <- SIDS.clusters$clusters[[2]]
> 
> #Assign colors to clusters for plotting
> cluster.col <- rep(0, length(nwb))
> cluster.col[MLC$regionsID] <- 2
> cluster.col[Secondary$regionsID] <- 3
> 
> #Plot detected high-rate clusters on a simple map
> plot(nc$geom, col = cluster.col, 
+   main = "Detected high rate clusters")
> legend("bottomleft",
+   legend = c(
+     paste("1- p-value:", MLC$p),
+     paste("2- p-value:", Secondary$p)
+   ),
+   text.col = c(2, 3)
+ )
> 
> #Interactive map visualization with mapview
> library(mapview)
Error in library(mapview) : there is no package called ‘mapview’
Execution halted