inla.mesh.basis.RdCalculate basis functions on a 1d or 2d inla.mesh
inla.mesh.basis(mesh,
type="b.spline",
n=3,
degree=2,
knot.placement="uniform.area",
rot.inv=TRUE,
boundary="free",
free.clamped=TRUE,
...)An inla.mesh.1d or inla.mesh object.
b.spline (default) for B-spline basis functions,
sph.harm for spherical harmonics (available opnly for meshes on the
sphere)
For B-splines, the number of basis functions in each direction (for
1d meshes n must be a scalar, and for planar 2d meshes a 2-vector).
For spherical harmonics, n is the maximal harmonic order.
Degree of B-spline polynomials.
See inla.mesh.1d.
For B-splines on the sphere, controls the latitudinal placements of
knots. "uniform.area" (default) gives uniform spacing in
sin(latitude), "uniform.latitude" gives uniform spacing in
latitudes.
For spherical harmonics on a sphere, rot.inv=TRUE gives the
rotationally invariant subset of basis functions.
Boundary specification, default is free boundaries.
See inla.mesh.1d for more information.
If TRUE and boundary is "free", the boundary
basis functions are clamped to 0/1 at the interval boundary by
repeating the boundary knots.
n = 100
loc = matrix(runif(n*2), n, 2)
mesh = inla.mesh.2d(loc, max.edge=0.05)
#> Warning: error in running command
#> Error in fmesher.read(prefix, "manifold"): File '/tmp/Rtmp4ztB6d/fmesher53bd3b05340e.manifold' does not exist.
basis = inla.mesh.basis(mesh, n=c(4,5))
#> Error: object 'mesh' not found
proj = inla.mesh.projector(mesh)
#> Error: object 'mesh' not found
image(proj$x, proj$y, inla.mesh.project(proj, basis[,7]))
#> 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=basis[,7], draw.edges=FALSE, draw.vertices=FALSE)
}
#> Loading required package: rgl
#> This build of rgl does not include OpenGL functions. Use
#> rglwidget() to display results, e.g. via options(rgl.printRglwidget = TRUE).
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'mesh' not found
# }