Extract a subset of a point pattern on a linear network.
A point pattern on a linear network (object of class
Subset index. A valid subset index in the usual R sense, indicating which points should be retained.
(object of class
Logical value indicating whether to remove unused levels of the marks, if the marks are a factor.
This function extracts a designated subset of a point pattern on a linear network.
[.lpp is a method for
[ for the
"lpp". It extracts a designated subset of a point pattern.
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,
(x$x[i], x$y[i]) for which
subset[i]=TRUE will be retained, and the others
will be deleted.
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.
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.
snip specifies what to do with segments of
the network which cross the boundary of the window
snip=FALSE, such segments are simply deleted.
snip=TRUE (the default), such segments are cut into pieces by the
j, and those pieces which lie inside the window
ji are included in the resulting network.
unmark to remove all the marks in a marked point
subset.lpp to remove only some columns of marks.
A point pattern on a linear network (of class
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.