| as.ppp {spatstat} | R Documentation |
Tries to coerce any reasonable kind of data to a point pattern
(an object of class "ppp")
for use by the spatstat package).
as.ppp(X) as.ppp(X, W)
X |
Data which will be converted into a point pattern |
W |
Data which define a default window for the pattern |
This function tries to coerce the data X to a point pattern
(an object of class "ppp"; see ppp.object for
an overview). The optional argument W is a default window for the
pattern; it is used only if a window is not specified in X.
The data X may be:
"ppp"
"spp" as used in the
Venables and Ripley package spatial
"quad" representing a quadrature scheme
(see quad.object)
x, y (vectors of equal
length) and xl, xu, yl, yu (numbers
giving the dimensions of a rectangular window)
x, y
In the last two cases, we need the second argument W
which is converted to a window object
by the function as.owin.
In the first three cases, W will be ignored.
Point pattern datasets can also be created by the function
ppp.
An object of class "ppp" (see ppp.object)
describing the point pattern and its window of observation.
Adrian Baddeley adrian@maths.uwa.edu.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner rolf@math.unb.ca http://www.math.unb.ca/~rolf
ppp,
ppp.object,
as.owin,
owin.object
library(spatstat) plot(c(0,1),c(0,1),type="n") xy <- locator(20) # click on 20 points in plot window pp <- as.ppp(xy, c(0,1,0,1)) w <- owin(c(0,1),c(0,1)) plot(w) # neater xy <- locator(20) # click on 20 points in plot window pp <- as.ppp(xy, w) xy <- matrix(runif(40), ncol=2) pp <- as.ppp(xy, c(0,1,0,1)) # Venables-Ripley format sp <- list(x=runif(10), y=runif(10), xl=0, xu=1, yl=0, yu=1) pp <- as.ppp(sp) # converted to our format