Skip to contents

Calculates the groupwise cross product of integration points in different dimensions and multiplies their weights accordingly, where the group is told by polygon ID. If the object defining points in a particular dimension has no weights attached to it all weights are assumed to be 1.


cprod(..., na.rm = NULL)



data.frame or SpatialPointsDataFrame objects, each one usually obtained by a call to the ipoints function. TODO #### na.rm and user-defined weight argument


logical; if TRUE, the rows with weight NA from the non-overlapping full_join will be removed; if FALSE, set the undefined weights to NA. If NULL (default), act as TRUE, but warn if any elements needed removing.


A data.frame or SpatialPointsDataFrame of multidimensional integration points and their weights


# \donttest{
# ipoints needs INLA
if (bru_safe_inla()) {
  # Create integration points in dimension 'myDim' and 'myDiscreteDim'
  ips1 <- ipoints(rbind(c(0, 3), c(3, 8)), 17, name = "myDim")
  ips2 <- ipoints(domain = c(1, 2, 4), name = "myDiscreteDim")

  # Calculate the cross product
  ips <- cprod(ips1, ips2)

  # Plot the integration points
  plot(ips$myDim, ips$myDiscreteDim, cex = 10 * ips$weight)

# }