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

> ### Name: dataSDM
> ### Title: R6 class for creating a 'dataSDM' object.
> ### Aliases: dataSDM
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ## Method `dataSDM$plot`
> ## ------------------------------------------------
> 
> 
>  if (requireNamespace('INLA')) {
+    
+  #Get Data
+  data("SolitaryTinamou")
+  proj <- CRS("+proj=longlat +ellps=WGS84")
+  data <- SolitaryTinamou$datasets
+  mesh <- SolitaryTinamou$mesh
+  mesh$crs <- proj
+  
+  #Set model up
+  organizedData <- intModel(data, Mesh = mesh, Coordinates = c('X', 'Y'),
+                              Projection = proj, responsePA = 'Present')
+  
+   #Create plot of data
+   organizedData$plot()
+ 
+ }
Loading required namespace: INLA
> 
> ## ------------------------------------------------
> ## Method `dataSDM$addData`
> ## ------------------------------------------------
> 
>  
>  if (requireNamespace('INLA')) {
+    
+  #Get Data
+  data("SolitaryTinamou")
+  proj <- CRS("+proj=longlat +ellps=WGS84")
+  
+  #Only select eBird data
+  ebird <- SolitaryTinamou$datasets$eBird
+  mesh <- SolitaryTinamou$mesh
+  mesh$crs <- proj
+  
+  #Set model up
+  organizedData <- intModel(ebird, Mesh = mesh, Coordinates = c('X', 'Y'),
+                              Projection = proj)
+                              
+  #Print summary
+  organizedData
+  
+  #Add new dataset
+  Parks = SolitaryTinamou$datasets$Parks
+  organizedData$addData(Parks, responsePA = 'Present')
+  
+  #Print summary
+  organizedData
+    
+  }
Summary of dataSDM data file:

Summary of present absence datasets:

 Name:           # of observations:
 -----           ------------------
 Parks |  ---  | 26                

Summary of present only datasets:

 Name:           # of observations:
 -----           ------------------
 ebird |  ---  | 315               

> 
> ## ------------------------------------------------
> ## Method `dataSDM$addBias`
> ## ------------------------------------------------
> 
>  
>  if (requireNamespace('INLA')) {
+    
+  #Get Data
+  data("SolitaryTinamou")
+  proj <- CRS("+proj=longlat +ellps=WGS84")
+  data <- SolitaryTinamou$datasets
+  mesh <- SolitaryTinamou$mesh
+  mesh$crs <- proj
+  
+  #Set model up
+  organizedData <- intModel(data, Mesh = mesh, Coordinates = c('X', 'Y'),
+                              Projection = proj, responsePA = 'Present')
+  
+ #Add bias field to eBird records
+ organizedData$addBias(datasetNames = 'eBird')
+ 
+ }
> 
> ## ------------------------------------------------
> ## Method `dataSDM$updateFormula`
> ## ------------------------------------------------
> 
> 
>  if (requireNamespace('INLA')) {
+    
+  #Get Data
+  data("SolitaryTinamou")
+  proj <- CRS("+proj=longlat +ellps=WGS84")
+  data <- SolitaryTinamou$datasets
+  mesh <- SolitaryTinamou$mesh
+  mesh$crs <- proj
+  Forest <- SolitaryTinamou$covariates$Forest
+  
+  
+  #Set model up
+  organizedData <- intModel(data, Mesh = mesh, Coordinates = c('X', 'Y'),
+                            spatialCovariates = Forest,
+                            Projection = proj, responsePA = 'Present',
+                            pointsSpatial = 'individual')
+ 
+  #Remove Forest from eBird
+  organizedData$updateFormula(datasetName = 'eBird', Formula = ~ . - Forest)
+  
+  #Add some scaling to Forest for Parks
+  organizedData$updateFormula('Parks', newFormula = ~ I(. +(Forest+1e-6)*scaling))
+  
+  #Now dd scaling to components
+  organizedData$changeComponents(addComponent = 'scaling') 
+  
+ }
Components:
~-1 + eBird_spatial(main = coordinates, model = eBird_field) + 
    Parks_spatial(main = coordinates, model = Parks_field) + 
    Gbif_spatial(main = coordinates, model = Gbif_field) + Forest(main = Forest, 
    model = "linear") + eBird_intercept(1) + Parks_intercept(1) + 
    Gbif_intercept(1) + scaling
<environment: 0x561a82f07848>
> 
> 
> ## ------------------------------------------------
> ## Method `dataSDM$changeComponents`
> ## ------------------------------------------------
> 
> ## Not run: 
> ##D 
> ##D  if (requireNamespace('INLA')) {
> ##D    
> ##D  #Get Data
> ##D  data("SolitaryTinamou")
> ##D  proj <- CRS("+proj=longlat +ellps=WGS84")
> ##D  data <- SolitaryTinamou$datasets
> ##D  mesh <- SolitaryTinamou$mesh
> ##D  mesh$crs <- proj
> ##D  Forest <- SolitaryTinamou$covariates$Forest
> ##D  
> ##D  
> ##D  #Set model up
> ##D  organizedData <- intModel(data, Mesh = mesh, Coordinates = c('X', 'Y'),
> ##D                            spatialCovariates = Forest,
> ##D                            Projection = proj, responsePA = 'Present')
> ##D 
> ##D  #Remove Forest from components
> ##D  organizedData$changeComponents(removeComponent = 'Forest')
> ##D 
> ##D }
> ##D 
> ## End(Not run)
> 
> ## ------------------------------------------------
> ## Method `dataSDM$priorsFixed`
> ## ------------------------------------------------
> 
>  if (requireNamespace('INLA')) {
+    
+  #Get Data
+  data("SolitaryTinamou")
+  proj <- CRS("+proj=longlat +ellps=WGS84")
+  data <- SolitaryTinamou$datasets
+  mesh <- SolitaryTinamou$mesh
+  mesh$crs <- proj
+  Forest <- SolitaryTinamou$covariates$Forest
+  
+  
+  #Set model up
+  organizedData <- intModel(data, Mesh = mesh, Coordinates = c('X', 'Y'),
+                            spatialCovariates = Forest,
+                            Projection = proj, responsePA = 'Present',
+                            pointsSpatial = 'individual')
+ 
+  #Add prior to Forest
+  organizedData$priorsFixed(Effect = 'Forest', mean.linear = 2, prec.linear = 0.1)
+ 
+ }
> 
> ## ------------------------------------------------
> ## Method `dataSDM$specifySpatial`
> ## ------------------------------------------------
> 
>  if (requireNamespace('INLA')) {
+    
+  #Get Data
+  data("SolitaryTinamou")
+  proj <- CRS("+proj=longlat +ellps=WGS84")
+  data <- SolitaryTinamou$datasets
+  mesh <- SolitaryTinamou$mesh
+  mesh$crs <- proj
+  Forest <- SolitaryTinamou$covariates$Forest
+  
+  
+  #Set model up
+  organizedData <- intModel(data, Mesh = mesh, Coordinates = c('X', 'Y'),
+                            spatialCovariates = Forest,
+                            Projection = proj, responsePA = 'Present')
+ 
+  #Specify the shared spatial field
+  organizedData$specifySpatial(sharedSpatial = TRUE, PC = TRUE, 
+                        prior.range = c(1,0.001),
+                        prior.sigma = c(1,0.001))
+ 
+ } 
> 
> ## ------------------------------------------------
> ## Method `dataSDM$changeLink`
> ## ------------------------------------------------
> 
> ## Not run: 
> ##D 
> ##D #Create data object
> ##D dataObj <- intModel(...)
> ##D 
> ##D #Print link function for a process
> ##D 
> ##D dataObj$changeLink(Dataset = Dataset, Species = Species)
> ##D 
> ##D #Change link function
> ##D dataObj$changeLink(Dataset = Dataset, Species = Species,
> ##D                    Link = "log")
> ##D 
> ## End(Not run)
> 
> ## ------------------------------------------------
> ## Method `dataSDM$spatialBlock`
> ## ------------------------------------------------
> 
>  if (requireNamespace('INLA')) {
+    
+  #Get Data
+  data("SolitaryTinamou")
+  proj <- CRS("+proj=longlat +ellps=WGS84")
+  data <- SolitaryTinamou$datasets
+  mesh <- SolitaryTinamou$mesh
+  mesh$crs <- proj
+  Forest <- SolitaryTinamou$covariates$Forest
+  
+  
+  #Set model up
+  organizedData <- intModel(data, Mesh = mesh, Coordinates = c('X', 'Y'),
+                            spatialCovariates = Forest,
+                            Projection = proj, responsePA = 'Present',
+                            pointsSpatial = 'individual')
+ 
+  #Specify the spatial block
+  organizedData$spatialBlock(k = 2, rows = 2, cols = 1, plot = TRUE)
+ 
+ } 
This function is deprecated! Please use 'cv_spatial' instead.
Warning in blockCV::spatialBlock(speciesData = do.call(sp::rbind.SpatialPoints,  :
  At least 10 of the points are not on the defined spatial blocks
Warning in st_point_on_surface.sfc(sf::st_zm(x)) :
  st_point_on_surface may not give correct results for longitude/latitude data
Error in stopifnot(is.list(Srl)) : 
  trying to get slot "polygons" from an object (class "sf") that is not an S4 object 
Calls: <Anonymous> ... sapply -> lapply -> FUN -> SpatialPolygons -> stopifnot
Execution halted