R: Extract Subset of Point Pattern on Linear Network

Extract.lpp {spatstat.linnet} | R Documentation

## Extract Subset of Point Pattern on Linear Network

### Description

Extract a subset of a point pattern on a linear network.

### Usage

      ## S3 method for class 'lpp'
    x[i, j, drop=FALSE, ..., snip=TRUE]

### Arguments

`x` | A point pattern on a linear network (object of class `"lpp"`).
`i` | Subset index. A valid subset index in the usual R sense, indicating which points should be retained.
`j` | Spatial window (object of class `"owin"`) delineating the region that should be retained.
`drop` | Logical value indicating whether to remove unused levels of the marks, if the marks are a factor.
`snip` | Logical. If `TRUE` (the default), segments of the network which cross the boundary of the window `j` will be cut by the boundary. If `FALSE`, these segments will be deleted.
`...` | Ignored.

### Details

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.

### Value

A point pattern on a linear network (of class `"lpp"`).

### Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner r.turner@auckland.ac.nz

### See Also

`lpp`, `subset.lpp`

### Examples

      # 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)

[Package spatstat.linnet version 2.3-1 Index]