Learn R Programming

inlabru (version 2.8.0)

fm_centroids: Extract triangle centroids from an inla.mesh

Description

Computes the centroids of the triangles of an inla.mesh object.

Usage

fm_centroids(x, format = NULL)

Value

An sf, data.frame, or SpatialPointsDataFrame object, with the vertex coordinates, and a .triangle column with the triangle indices.

Arguments

x

An inla.mesh object.

format

character; "sf", "df", "sp"

Author

Finn Lindgren finn.lindgren@gmail.com

See Also

fm_vertices()

Examples

Run this code
# \donttest{
if (require(ggplot2, quietly = TRUE)) {
  data("mrsea", package = "inlabru")
  vrt <- fm_centroids(mrsea$mesh, format = "sp")
  ggplot() +
    gg(mrsea$mesh) +
    gg(vrt, color = "red")
}
# }

Run the code above in your browser using DataLab