subset.lpp | R Documentation |

Given a point pattern on a linear network, return the subset of points which satisfy a specified condition.

## S3 method for class 'lpp' subset(x, subset, select, drop=FALSE, ...)

`x` |
A point pattern on a linear network
(object of class |

`subset` |
Logical expression indicating which points are to be kept.
The expression may involve the names of spatial coordinates
( |

`select` |
Expression indicating which columns of marks should be kept.
The |

`drop` |
Logical value indicating whether to remove unused levels of the marks, if the marks are a factor. |

`...` |
Ignored. |

This is a method for the generic function `subset`

.
It extracts the subset of points of `x`

that satisfy the logical expression
`subset`

, and retains only the columns of marks that are
specified by the expression `select`

. The result is always a point
pattern, with the same window as `x`

.

The argument `subset`

determines the subset of points that
will be extracted. It should be a logical expression.
It may involve the variable names
`x`

and `y`

representing the Cartesian coordinates;
the names of other spatial coordinates or local coordinates;
the name `marks`

representing the marks;
and (if there is more than one column of marks)
the names of individual columns of marks.
The default is to keep all points.

The argument `select`

determines which columns of marks
will be retained (if there are several columns of marks).
It should be an expression involving the names of columns of marks
(which will be interpreted as integers representing the positions of
these columns). For example if there are columns of marks named
`A`

to `Z`

, then `select=D:F`

is a valid expression
and means that columns `D`

, `E`

and `F`

will be
retained. Similarly `select=-(A:C)`

is valid and means that columns
`A`

to `C`

will be deleted.
The default is to retain all columns.

Setting `subset=FALSE`

will produce an empty point pattern
(i.e. containing zero points) in the same window as `x`

.
Setting `select=FALSE`

or `select= -marks`

will
remove all the marks from `x`

.

The argument `drop`

determines whether to remove
unused levels of a factor, if the resulting point pattern is multitype
(i.e. the marks are a factor) or if the marks are a data frame
in which some of the columns are factors.

The result is always a point pattern, of the same class as `x`

.
Spatial coordinates (and local
coordinates) are always retained. To extract only some
columns of marks or coordinates as a data frame,
use `subset(as.data.frame(x), ...)`

A point pattern of the same class as `x`

, in the same
spatial window as `x`

. The result is a subset of `x`

,
possibly with some columns of marks removed.

Alternatively the argument `subset`

can be any kind of subset index
acceptable to `[.lpp`

.
This argument selects which points of `x`

will be retained.

**Warning:** if the argument `subset`

is
a window, this is interpreted as specifying the subset of points that fall
inside that window, but the resulting point pattern has the same window
as the original pattern `x`

.

.

`subset.ppp`

,
`[.lpp`

.

v <- subset(chicago, x + y > 1100 & marks == "assault") vv <- subset(chicago, x + y > 1100 & marks == "assault", drop=TRUE)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.