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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: getSample
> ### Title: Stratified random sampling
> ### Aliases: getSample
> 
> ### ** Examples
> 
> # Load raster package
> library(raster)
Loading required package: sp
> 
> # Open and stack ALS metrics
> elev_p95 <- raster(system.file("extdata/examples/ALS_metrics_p95.tif",package="foster"))
> cover <- raster(system.file("extdata/examples/ALS_metrics_cov_mean.tif",package="foster"))
> Y_vars <- stack(elev_p95,cover)
> names(Y_vars) <- c("p95","cover")
> 
> # Sample 5 cells in 3 strata (kmeans clusters). Sampled points should be at least 30 m apart.
> set.seed(1234) #for example reproducibility
> sample_strata <- getSample(Y_vars,
+                            n = 5,
+                            strata = 3,
+                            mindist = 30)
cluster 2: 3 samples to select
Warning: replacing previous import ‘spatstat.utils::RelevantNA’ by ‘spatstat.sparse::RelevantNA’ when loading ‘spatstat.geom’
Warning: replacing previous import ‘spatstat.utils::grokIndexVector’ by ‘spatstat.sparse::grokIndexVector’ when loading ‘spatstat.geom’
Warning: replacing previous import ‘spatstat.utils::fullIndexSequence’ by ‘spatstat.sparse::fullIndexSequence’ when loading ‘spatstat.geom’
Warning: replacing previous import ‘spatstat.utils::positiveIndex’ by ‘spatstat.sparse::positiveIndex’ when loading ‘spatstat.geom’
Warning: replacing previous import ‘spatstat.utils::replacementIndex’ by ‘spatstat.sparse::replacementIndex’ when loading ‘spatstat.geom’
Warning: replacing previous import ‘spatstat.utils::RelevantEmpty’ by ‘spatstat.sparse::RelevantEmpty’ when loading ‘spatstat.geom’
Warning: replacing previous import ‘spatstat.utils::isRelevantZero’ by ‘spatstat.sparse::isRelevantZero’ when loading ‘spatstat.geom’
Warning: replacing previous import ‘spatstat.utils::logicalIndex’ by ‘spatstat.sparse::logicalIndex’ when loading ‘spatstat.geom’
Warning: replacing previous import ‘spatstat.utils::RelevantZero’ by ‘spatstat.sparse::RelevantZero’ when loading ‘spatstat.geom’
Warning: replacing previous import ‘spatstat.utils::strictIndexSequence’ by ‘spatstat.sparse::strictIndexSequence’ when loading ‘spatstat.geom’
Warning: replacing previous import ‘spatstat.utils::RelevantNA’ by ‘spatstat.sparse::RelevantNA’ when loading ‘spatstat.core’
Warning: replacing previous import ‘spatstat.utils::grokIndexVector’ by ‘spatstat.sparse::grokIndexVector’ when loading ‘spatstat.core’
Warning: replacing previous import ‘spatstat.utils::fullIndexSequence’ by ‘spatstat.sparse::fullIndexSequence’ when loading ‘spatstat.core’
Warning: replacing previous import ‘spatstat.utils::positiveIndex’ by ‘spatstat.sparse::positiveIndex’ when loading ‘spatstat.core’
Warning: replacing previous import ‘spatstat.utils::replacementIndex’ by ‘spatstat.sparse::replacementIndex’ when loading ‘spatstat.core’
Warning: replacing previous import ‘spatstat.utils::RelevantEmpty’ by ‘spatstat.sparse::RelevantEmpty’ when loading ‘spatstat.core’
Warning: replacing previous import ‘spatstat.utils::isRelevantZero’ by ‘spatstat.sparse::isRelevantZero’ when loading ‘spatstat.core’
Warning: replacing previous import ‘spatstat.utils::logicalIndex’ by ‘spatstat.sparse::logicalIndex’ when loading ‘spatstat.core’
Warning: replacing previous import ‘spatstat.utils::RelevantZero’ by ‘spatstat.sparse::RelevantZero’ when loading ‘spatstat.core’
Warning: replacing previous import ‘spatstat.utils::strictIndexSequence’ by ‘spatstat.sparse::strictIndexSequence’ when loading ‘spatstat.core’
Error: 'crossdist' is not an exported object from 'namespace:spatstat'
Execution halted