# with.msr

##### Evaluate Expression Involving Components of a Measure

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

##### Usage

```
## S3 method for class 'msr':
with(data, expr, \dots)
```

##### Arguments

- data
- A measure (object of class
`"msr"`

). - expr
- An expression to be evaluated.
- ...
- Ignored.

##### Details

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 Rlanguage. 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
`atommass`

(numeric) massess 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]`

.

##### Value

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

##### See Also

##### Examples

```
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.42-2, License: GPL (>= 2)*