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

> ### Name: estimate-methods
> ### Title: Estimating Statistics
> ### Aliases: estimate-methods estimate
> ###   estimate,character,CompactStratification,SamplingPatternRandomSamplingUnits,data.frame-method
> ###   estimate,character,CompactStratificationEqualArea,SamplingPatternRandomComposite,data.frame-method
> ###   estimate,SamplingVariance,CompactStratification,SamplingPatternRandomSamplingUnits,data.frame-method
> ###   estimate,SamplingVariance,CompactStratificationEqualArea,SamplingPatternRandomComposite,data.frame-method
> ###   estimate,SpatialCumulativeDistributionFunction,CompactStratification,SamplingPatternRandomSamplingUnits,data.frame-method
> ###   estimate,SpatialMean,CompactStratification,SamplingPatternRandomSamplingUnits,data.frame-method
> ###   estimate,SpatialMean,CompactStratificationEqualArea,SamplingPatternRandomComposite,data.frame-method
> ###   estimate,SpatialVariance,CompactStratification,SamplingPatternRandomSamplingUnits,data.frame-method
> ###   estimate,StandardError,CompactStratification,SamplingPatternRandomSamplingUnits,data.frame-method
> ### Keywords: methods
> 
> ### ** Examples
> 
> 
> # Note: the example below requires the 'sf'-package.
> if (require(sf)) {
+     # read vector representation of the "Mijdrecht" area
+     shp <- as(st_read(
+         dsn = system.file("maps", package = "spcosa"),
+         layer = "mijdrecht"), "Spatial")
+ 
+     # stratify into 30 strata
+     myStratification <- stratify(shp, nStrata = 30, nTry = 10, verbose = TRUE)
+ 
+     # random sampling of two sampling units per stratum
+     mySamplingPattern <- spsample(myStratification, n = 2)
+ 
+     # plot sampling pattern
+     plot(myStratification, mySamplingPattern)
+ 
+     # simulate data
+     # (in real world cases these data have to be obtained by field work etc.)
+     myData <- as(mySamplingPattern, "data.frame")
+     myData$observation <- rnorm(n = nrow(myData), mean = 10, sd = 1)
+ 
+     # design-based inference
+     estimate("spatial mean", myStratification, mySamplingPattern, myData["observation"])
+     estimate("sampling variance", myStratification, mySamplingPattern, myData["observation"])
+     estimate("standard error", myStratification, mySamplingPattern, myData["observation"])
+     estimate("spatial variance", myStratification, mySamplingPattern, myData["observation"])
+     estimate("scdf", myStratification, mySamplingPattern, myData["observation"])
+ }
Loading required package: sf
Linking to GEOS 3.12.2, GDAL 3.5.3, PROJ 9.3.1; sf_use_s2() is TRUE
Reading layer `mijdrecht' from data source 
  `/data/gannet/ripley/R/packages/tests-clang/spcosa.Rcheck/spcosa/maps' 
  using driver `ESRI Shapefile'
Simple feature collection with 1 feature and 2 fields
Geometry type: POLYGON
Dimension:     XY
Bounding box:  xmin: 115796.2 ymin: 463380.5 xmax: 121670.8 ymax: 471524.6
CRS:           NA
2025-03-12 15:35:27 | optimizing configuration 1 
2025-03-12 15:35:28 |    current objective function value: 50485.85 
2025-03-12 15:35:28 |    minimum objective function value: 50485.85 
2025-03-12 15:35:28 | optimizing configuration 2 
[gannet:3688714:0:3688714] Caught signal 11 (Segmentation fault: invalid permissions for mapped object at address 0x7fd7a88c2000)
==== backtrace (tid:3688714) ====
 0  /lib64/libucs.so.0(ucs_handle_error+0x2e4) [0x7fd718e65144]
 1  /lib64/libucs.so.0(+0x2880d) [0x7fd718e6680d]
 2  /lib64/libucs.so.0(+0x289dd) [0x7fd718e669dd]
 3  [0x7fd7857b8802]
=================================

 *** caught segfault ***
address 0x4d20038490a, cause 'unknown'

Traceback:
 1: .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,     .jcast(if (inherits(o, "jobjRef") || inherits(o, "jarrayRef")) o else cl,         "java/lang/Object"), .jnew("java/lang/String", method),     j_p, j_pc, use.true.class = TRUE, evalString = simplify,     evalArray = FALSE)
 2: .jrcall(x, name, ...)
 3: p$optimize()
 4: .local(object, ...)
 5: stratify(object = object, nStrata = nStrata, priorPoints = priorPoints,     maxIterations = maxIterations, nTry = nTry, equalArea = equalArea,     verbose = verbose)
 6: stratify(object = object, nStrata = nStrata, priorPoints = priorPoints,     maxIterations = maxIterations, nTry = nTry, equalArea = equalArea,     verbose = verbose)
 7: .local(object, ...)
 8: stratify(shp, nStrata = 30, nTry = 10, verbose = TRUE)
 9: stratify(shp, nStrata = 30, nTry = 10, verbose = TRUE)
An irrecoverable exception occurred. R is aborting now ...