fm_cprod | R Documentation |
Calculates the groupwise cross product of integration points in different dimensions and multiplies their weights accordingly. If the object defining points in a particular dimension has no weights attached to it all weights are assumed to be 1.
fm_cprod(..., na.rm = NULL, .blockwise = FALSE)
... |
|
na.rm |
logical; if |
.blockwise |
logical; if |
A data.frame
, sf
, or SpatialPointsDataFrame
of multidimensional
integration points and their weights
# fm_int needs INLA
if (TRUE &&
require("ggplot2")) {
# Create integration points in dimension 'myDim' and 'myDiscreteDim'
ips1 <- fm_int(fm_mesh_1d(1:20),
rbind(c(0, 3), c(3, 8)),
name = "myDim"
)
ips2 <- fm_int(domain = c(1, 2, 4), name = "myDiscreteDim")
# Calculate the cross product
ips <- fm_cprod(ips1, ips2)
# Plot the integration points
ggplot(ips) +
geom_point(aes(myDim, myDiscreteDim, size = weight)) +
scale_size_area()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.