Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Extract.ppx

Extract Subset of Multidimensional Point Pattern


Description

Extract a subset of a multidimensional point pattern.

Usage

## S3 method for class 'ppx'
x[i, drop=FALSE, clip=FALSE, ...]

Arguments

x

A multidimensional point pattern (object of class "ppx").

i

Subset index. A valid subset index in the usual R sense, indicating which points should be retained; or a spatial domain of class "boxx" or "box3".

drop

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

clip

Logical value indicating how to form the domain of the resulting point pattern, when i is a box (object of class "boxx"). If clip=FALSE (the default), the result has domain equal to i. If clip=TRUE, the resulting domain is the intersection between the domain of x and the domain i.

...

Ignored.

Details

This function extracts a designated subset of a multidimensional point pattern.

The function [.ppx is a method for [ for the class "ppx". It extracts a designated subset of a point pattern. The argument i may be either

  • 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.

  • a spatial domain of class "boxx" or "box3". Points falling inside this region will be retained.

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.

Use the function unmark to remove marks from a marked point pattern.

Value

A multidimensional point pattern (of class "ppx").

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk

See Also

Examples

df <- data.frame(x=runif(4),y=runif(4),z=runif(4))
   X <- ppx(data=df, coord.type=c("s","s","t"))
   X[-2]
   Y <- ppx(coords(cells), domain = boxx(c(0,1),c(0,1)))
   dom <- shift(domain(Y), vec = c(.5,.5))
   Y[dom]
   Y[dom, clip=TRUE]

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.