Hello all,
I'm running INLA 25.3.24 and INLAspacetime 0.1.12 in R 4.4.3.
When running the following to code to simulate a barrier model I got the following error:
# load required packages
library("INLA")
library("raster")
library("INLAspacetime")
Loading required package: Matrix
This is INLA_25.03.24 built 2025-03-24 16:12:01 UTC.
- See
www.r-inla.org/contact-us for how to get help.
- List available models/likelihoods/etc with inla.list.models()
- Use inla.doc(<NAME>) to access documentation
Loading required package: sp
Loading required package: fmesher
see more on
https://eliaskrainski.github.io/INLAspacetime
> set.seed(201805)
# load required spatial files for building the mesh
greenhouses <- shapefile("/home/jrequena/sampling_simulation/domain.shp")
points <- spsample(greenhouses, n = 40, type = "random")# extract a random sample of points outside greenhouses
> range <- 1000 # in meters
bound.outer = 200
max.edge <- (1/10) * range
# Build the mesh; lengths in meters
mesh = inla.mesh.2d(boundary = greenhouses,
loc=cbind(points$x, points$y),
max.edge = c(0.5,4)*max.edge,
cutoff = 2,
crs = CRS("+proj=utm +zone=30 +datum=WGS84 +units=m +no_defs"),
offset = c(max.edge, bound.outer))
> water.tri = inla.over_sp_mesh(greenhouses, y = mesh, type = "centroid", ignore.CRS = TRUE)
num.tri = length(mesh$graph$tv[, 1])
barrier.tri = setdiff(1:num.tri, water.tri[[1]])
poly.barrier = inla.barrier.polygon(mesh,
barrier.triangles = barrier.tri)
crs(poly.barrier) <- CRS("+proj=utm +zone=30 +datum=WGS84 +units=m +no_defs")
> prec <- 1
barrier.model <- inla.barrier.pcmatern(mesh, prior.range = c(range,0.5), prior.sigma = c(prec,0.5),
barrier.triangles = barrier.tri, range.fraction = 0.5, enable.INLAspacetime = FALSE)
Error in as.character(package) :
cannot coerce type 'closure' to vector of type 'character'
In addition: Warning messages:
1: In inla.barrier.pcmatern(mesh, prior.range = c(range, 0.5), prior.sigma = c(prec, :
Please install the `INLAspacetime` package
which contains an implementation that runs faster!
2: In inla.barrier.fem(mesh, barrier.triangles = barrier.triangles) :
Using implementation from the `INLAspacetime` package
-----------------------------------------------------------------------------------------------------------------
I have tried a bunch of stuff with no success.
I appreciate any help.
Thank you in advance.
Regards!
Juanmi