# \donttest{
# The INLA package is required
if (bru_safe_inla(quietly = TRUE) &&
bru_safe_sp() &&
require("sp")) {
vertices <- seq(0, 3, by = 0.1)
mesh <- fm_mesh_1d(vertices)
loglambda <- 5 - 0.5 * vertices
pts <- sample.lgcp(mesh, loglambda)
pts$y <- 0
plot(vertices, exp(loglambda), type = "l", ylim = c(0, 150))
points(pts, pch = "|")
}
# }
# \donttest{
# The INLA package is required
if (bru_safe_inla(quietly = TRUE) &&
require(ggplot2, quietly = TRUE) &&
bru_safe_sp() &&
require("sp")) {
data("gorillas", package = "inlabru")
pts <- sample.lgcp(gorillas$mesh,
loglambda = 1.5,
samplers = gorillas$boundary
)
ggplot() +
gg(gorillas$mesh) +
gg(pts)
}
# }
Run the code above in your browser using DataLab