Evaluate Expression Involving Components of a Measure

An expression involving the names of components of a measure is evaluated.

manip, spatial
# S3 method for msr
with(data, expr, …)

A measure (object of class "msr").


An expression to be evaluated.



This is a method for the generic function with for the class "msr". The argument data should be an object of class "msr" representing a measure (a function which assigns a value to each subset of two-dimensional space).

This function can be used to extract the components of the measure, or to perform more complicated manipulations of the components.

The argument expr should be an un-evaluated expression in the R language. The expression may involve any of the variable names listed below with their corresponding meanings.

qlocations (point pattern) all quadrature locations
qweights (numeric) all quadrature weights
density (numeric) density value at each quadrature point
discrete (numeric) discrete mass at each quadrature point
continuous (numeric) increment of continuous component
increment (numeric) increment of measure
is.atom (logical) whether quadrature point is an atom
atoms (point pattern) locations of atoms

The measure is the sum of discrete and continuous components. The discrete component assigns non-zero mass to several points called atoms. The continuous component has a density which should be integrated over a region to determine the value for that region.

An object of class "msr" approximates the continuous component by a sum over quadrature points. The quadrature points are chosen so that they include the atoms of the measure. In the list above, we have increment = continuous + discrete, continuous = density * qweights, is.atom = (discrete > 0), atoms = qlocations[is.atom] and atommass = discrete[is.atom].


The result of evaluating the expression could be an object of any kind.

See Also

msr, split.msr

  • with.msr
   X <- rpoispp(function(x,y) { exp(3+3*x) })
   fit <- ppm(X, ~x+y)
   rp <- residuals(fit, type="pearson")

   with(rp, atoms)
   with(rp, qlocations %mark% continuous)
# }
Documentation reproduced from package spatstat, version 1.55-1, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.