Extract Subset of Point Pattern on Linear Network
Extract a subset of a point pattern on a linear network.
## S3 method for class 'lpp' x[i, j, drop=FALSE, ..., snip=TRUE]
x |
A point pattern on a linear network (object of class |
i |
Subset index. A valid subset index in the usual R sense, indicating which points should be retained. |
j |
Spatial window
(object of class |
drop |
Logical value indicating whether to remove unused levels of the marks, if the marks are a factor. |
snip |
Logical. If |
... |
Ignored. |
This function extracts a designated subset of a point pattern on a linear network.
The function [.lpp
is a method for [
for the
class "lpp"
. It extracts a designated subset of a point pattern.
The argument i
should be a subset index in the usual R sense:
either a numeric vector
of positive indices (identifying the points to be retained),
a numeric vector of negative indices (identifying the points
to be deleted) or a logical vector of length equal to the number of
points in the point pattern x
. In the latter case,
the points (x$x[i], x$y[i])
for which
subset[i]=TRUE
will be retained, and the others
will be deleted.
The argument j
, if present, should be a spatial window.
The pattern inside the region will be retained.
Line segments that cross the boundary of the window
are deleted in the current implementation.
The argument drop
determines whether to remove
unused levels of a factor, if the point pattern is multitype
(i.e. the marks are a factor) or if the marks are a data frame or hyperframe
in which some of the columns are factors.
The argument snip
specifies what to do with segments of
the network which cross the boundary of the window j
.
If snip=FALSE
, such segments are simply deleted.
If snip=TRUE
(the default), such segments are cut into pieces by the
boundary of j
, and those pieces which lie inside the window
ji
are included in the resulting network.
Use unmark
to remove all the marks in a marked point
pattern, and subset.lpp
to remove only some columns of marks.
A point pattern on a linear network (of class "lpp"
).
Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner r.turner@auckland.ac.nz
# Chicago crimes data - remove cases of assault chicago[marks(chicago) != "assault"] # equivalent to subset(chicago, select=-assault) # spatial window subset B <- owin(c(350, 700), c(600, 1000)) plot(chicago) plot(B, add=TRUE, lty=2, border="red", lwd=3) op <- par(mfrow=c(1,2), mar=0.6+c(0,0,1,0)) plot(B, main="chicago[B, snip=FALSE]", lty=3, border="red") plot(chicago[, B, snip=FALSE], add=TRUE) plot(B, main="chicago[B, snip=TRUE]", lty=3, border="red") plot(chicago[, B, snip=TRUE], add=TRUE) par(op)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.