"owin".as.owin(W, ..., fatal=TRUE) ## S3 method for class 'owin':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'ppp':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'ppm':
as.owin(W, \dots, from=c("points", "covariates"), fatal=TRUE)
## S3 method for class 'kppm':
as.owin(W, \dots, from=c("points", "covariates"), fatal=TRUE)
## S3 method for class 'lppm':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'psp':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'quad':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'tess':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'im':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'gpc.poly':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'data.frame':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'distfun':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'nnfun':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'funxy':
as.owin(W, \dots, fatal=TRUE)
## S3 method for class 'rmhmodel':
as.owin(W, \dots, fatal=FALSE)
## S3 method for class 'default':
as.owin(W, \dots, fatal=TRUE)
"owin" (see owin.object)
specifying an observation window."owin" is a way of specifying the observation window
for a point pattern. See owin.object for an overview.
This function converts data in any of several formats
into an object of class "owin" for use by the W may be
"owin"xrange,yrangespecifying the$x$and$y$dimensions of a rectangle(xmin, xmax, ymin, ymax))
specifying the$x$and$y$dimensions of a rectanglexl,xu,yl,yuspecifying the$x$and$y$dimensions of a rectangle
as(xmin, xmax) = (xl, xu)and(ymin, ymax) = (yl, yu). This will accept objects of
classsppused in the Venables and Ripley"gpc.poly"from the"ppp"representing a point pattern.
In this case, the object'swindowstructure will be
extracted."psp"representing a line segment pattern.
In this case, the object'swindowstructure will be
extracted."tess"representing a tessellation.
In this case, the object'swindowstructure will be
extracted."quad"representing a quadrature scheme.
In this case, the window of thedatacomponent will be
extracted."im"representing a pixel image.
In this case, a window of type"mask"will be returned,
with the same pixel raster coordinates as the image.
An image pixel value ofNA, signifying that the pixel
lies outside the window, is transformed into the logical valueFALSE, which is the corresponding convention for window masks."ppm"or"kppm"representing a fitted point process
model. In this case, iffrom="data"(the default),as.owinextracts the original point
pattern data to which the model was fitted, and returns the
observation window of this point pattern. Iffrom="covariates"thenas.owinextracts the
covariate images to which the model was fitted,
and returns a binary mask window that specifies the pixel locations."lppm"representing a fitted point process model on a linear network.
In this case,as.owinextracts the linear network
and returns a window containing this network.data.framewith exactly three columns. Each row of the
data frame corresponds to one pixel. Each row contains the$x$and$y$coordinates of a pixel, and a logical value
indicating whether the pixel lies inside the window."distfun","nnfun"or"funxy"representing a function of spatial location,
defined on a spatial domain. The spatial domain of the function will be
extracted."rmhmodel"representing a
point process model that can be simulated usingrmh.
The window (spatial domain) of the model will be extracted.
The window may beNULLin some circumstances (indicating that the
simulation window has not yet been determined). This is not treated
as an error, because the argumentfataldefaults toFALSEfor this method.W is not in one of these formats
and cannot be converted to a window, then an error will
be generated (if fatal=TRUE) or a value of NULL
will be returned (if fatal=FALSE). The function as.owin is generic, with methods for
"owin",
"im" and
"ppp" as well as the default method.
owin.object,
owinw <- as.owin(c(0,1,0,1))
w <- as.owin(list(xrange=c(0,5),yrange=c(0,10)))
# point pattern
data(demopat)
w <- as.owin(demopat)
# image
Z <- as.im(function(x,y) { x + 3}, unit.square())
w <- as.owin(Z)
# Venables & Ripley 'spatial' package
require(spatial)
towns <- ppinit("towns.dat")
w <- as.owin(towns)
detach(package:spatial)Run the code above in your browser using DataLab