# quadrats

##### Divide Region into Quadrats

Divides window into rectangular quadrats and returns the quadrats as a tessellation.

##### Usage

`quadrats(X, nx = 5, ny = nx, xbreaks = NULL, ybreaks = NULL, keepempty=FALSE)`

##### Arguments

- X
A window (object of class

`"owin"`

) or anything that can be coerced to a window using`as.owin`

, such as a point pattern.- nx,ny
Numbers of quadrats in the \(x\) and \(y\) directions. Incompatible with

`xbreaks`

and`ybreaks`

.- xbreaks
Numeric vector giving the \(x\) coordinates of the boundaries of the quadrats. Incompatible with

`nx`

.- ybreaks
Numeric vector giving the \(y\) coordinates of the boundaries of the quadrats. Incompatible with

`ny`

.- keepempty
Logical value indicating whether to delete or retain empty quadrats. See Details.

##### Details

If the window `X`

is a rectangle, it is divided into
an `nx * ny`

grid of rectangular tiles or `quadrats'.

If `X`

is not a rectangle, then the bounding rectangle of
`X`

is first divided into an `nx * ny`

grid of rectangular
tiles, and these tiles are then intersected with the window `X`

.

The resulting tiles are returned as a tessellation (object of class
`"tess"`

) which can be plotted and used in other analyses.

If `xbreaks`

is given, it should be a numeric vector
giving the \(x\) coordinates of the quadrat boundaries.
If it is not given, it defaults to a
sequence of `nx+1`

values equally spaced
over the range of \(x\) coordinates in the window `Window(X)`

.

Similarly if `ybreaks`

is given, it should be a numeric
vector giving the \(y\) coordinates of the quadrat boundaries.
It defaults to a vector of `ny+1`

values
equally spaced over the range of \(y\) coordinates in the window.
The lengths of `xbreaks`

and `ybreaks`

may be different.

By default (if `keepempty=FALSE`

), any rectangular tile which
does not intersect the window `X`

is
ignored, and only the non-empty intersections are treated as quadrats,
so the tessellation may consist of fewer than `nx * ny`

tiles.
If `keepempty=TRUE`

, empty intersections are retained,
and the tessellation always contains exactly `nx * ny`

tiles,
some of which may be empty.

##### Value

A tessellation (object of class `"tess"`

) as described under
`tess`

.

##### See Also

##### Examples

```
# NOT RUN {
W <- square(10)
Z <- quadrats(W, 4, 5)
plot(Z)
data(letterR)
plot(quadrats(letterR, 5, 7))
# }
```

*Documentation reproduced from package spatstat, version 1.55-1, License: GPL (>= 2)*