Subset of Point Pattern Satisfying A Condition
Given a point pattern, return the subset of points which satisfy a specified condition.
## S3 method for class 'ppp': subset(x, subset, select, \dots)
## S3 method for class 'pp3': subset(x, subset, select, \dots)
## S3 method for class 'lpp': subset(x, subset, select, \dots)
## S3 method for class 'ppx': subset(x, subset, select, \dots)
- A point pattern (object of class
- Logical expression indicating which points are to be kept.
The expression may involve the names of spatial coordinates
y, etc), the
marks, and (if there is more than one column of marks) the names
- Expression indicating which columns of marks should be kept.
This is a method for the generic function
It extracts the subset of points of
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
subset determines the subset of points that
will be extracted. It should be a logical expression.
It may involve the variable names
y representing the Cartesian coordinates;
the names of other spatial coordinates or local coordinates;
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.
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
select=D:F is a valid expression
and means that columns
F will be
select=-(A:C) is valid and means that columns
C will be deleted.
The default is to retain all columns.
subset=FALSE will produce an empty point pattern
(i.e. containing zero points) in the same window as
select= -marks will
remove all the marks from
The result is always a point pattern, of the same class as
Spatial coordinates (and local
coordinates) are always retained. To extract only some
columns of marks or coordinates as a data frame,
- 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.
plot(subset(cells, x > 0.5)) subset(amacrine, marks == "on") subset(redwood, nndist(redwood) > 0.04) subset(finpines, select=height) subset(finpines, diameter > 2, height) subset(nbfires, year==1999 & ign.src == "campfire", select=cause:fnl.size) v <- subset(chicago, x + y > 1100 & marks == "assault") a <- subset(rpoispp3(40), z > 0.5)