inla.mesh.project.RdCalculate a lattice projection to/from an inla.mesh
inla.mesh.project(...)
inla.mesh.projector(...)
# S3 method for class 'inla.mesh'
inla.mesh.projector(mesh,
loc = NULL,
lattice = NULL,
xlim = NULL,
ylim = NULL,
dims = c(100,100),
projection = NULL,
crs = NULL,
...)
# S3 method for class 'inla.mesh.1d'
inla.mesh.projector(mesh,
loc = NULL,
xlim = mesh$interval,
dims = 100, ...)
# S3 method for class 'inla.mesh.projector'
inla.mesh.project(projector, field, ...)
# S3 method for class 'inla.mesh'
inla.mesh.project(mesh, loc, field = NULL,
crs=NULL,
...)
# S3 method for class 'inla.mesh.1d'
inla.mesh.project(mesh, loc, field = NULL, ...)An inla.mesh or inla.mesh.1d object.
Projection locations.
Can be a matrix or a SpatialPoints or a SpatialPointsDataFrame object.
An inla.mesh.lattice object.
X-axis limits for a lattice. For R2 meshes, defaults to covering the domain.
Y-axis limits for a lattice. For R2 meshes, defaults to covering the domain.
Lattice dimensions.
An inla.mesh.projector object.
Basis function weights, one per mesh basis function, describing the function to be avaluated at the projection locationssFunction values for on the mesh
One of c("default", "longlat", "longsinlat", "mollweide").
An optional CRS or inla.CRS object associated with loc and/or
lattice.
Additional arguments passed on to methods.
The call inla.mesh.project(mesh, loc, field=..., ...), is a
shortcut to inla.mesh.project(inla.mesh.projector(mesh, loc), field).
For inla.mesh.project(mesh, ...), a list with projection information.
For inla.mesh.projector(mesh, ...), an inla.mesh.projector object.
For inla.mesh.project(projector, field, ...), a field projected
from the mesh onto the locations given by the projector object.
n = 20
loc = matrix(runif(n*2), n, 2)
mesh = inla.mesh.create(loc, refine=list(max.edge=0.05))
#> Warning: error in running command
#> Error in fmesher.read(prefix, "manifold"): File '/tmp/Rtmp4ztB6d/fmesher53bd1baab773.manifold' does not exist.
proj = inla.mesh.projector(mesh)
#> Error: object 'mesh' not found
field = cos(mesh$loc[,1]*2*pi*3)*sin(mesh$loc[,2]*2*pi*7)
#> Error: object 'mesh' not found
image(proj$x, proj$y, inla.mesh.project(proj, field))
#> Error in (function (cond) .Internal(C_tryCatchHelper(addr, 1L, cond)))(structure(list(message = "object of type 'closure' is not subsettable", call = proj$x, object = function (object, ...) UseMethod("proj")), class = c("notSubsettableError", "error", "condition"))): error in evaluating the argument 'x' in selecting a method for function 'image': object of type 'closure' is not subsettable
# \donttest{
if (require(rgl)) {
plot(mesh, rgl=TRUE, col=field, draw.edges=FALSE, draw.vertices=FALSE)
}
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'mesh' not found
# }