| as.owin.quadrattest {spatstat.explore} | R Documentation |
Convert Data To Class owin
Description
Converts data specifying an observation window
in any of several formats, into an object of class "owin".
Usage
## S3 method for class 'quadrattest'
as.owin(W, ..., fatal=TRUE)
Arguments
W |
Data specifying an observation window, in any of several formats described under Details below. |
fatal |
Logical value determining what to do if the data cannot be converted to an observation window. See Details. |
... |
Ignored. |
Details
The class "owin" is a way of specifying the observation window
for a point pattern. See owin.object for an overview.
The generic function as.owin
converts data in any of several formats
into an object of class "owin" for use by the spatstat
package. The function as.owin
is generic, with methods
for different classes of objects, and a default method.
The argument W may be
-
an object of class
"owin" -
a structure with entries
xrange,yrangespecifying thexandydimensions of a rectangle -
a structure with entries named
xmin,xmax,ymin,ymax(in any order) specifying thexandydimensions of a rectangle. This will accept objects of classbboxin thesfpackage. -
a numeric vector of length 4 (interpreted as
(xmin, xmax, ymin, ymax)in that order) specifying thexandydimensions of a rectangle -
a structure with entries named
xl,xu,yl,yu(in any order) specifying thexandydimensions of a rectangle as(xmin, xmax) = (xl, xu)and(ymin, ymax) = (yl, yu). This will accept objects of classsppused in the Venables and Ripley spatial package. -
an object of class
"ppp"representing a point pattern. In this case, the object'swindowstructure will be extracted. -
an object of class
"psp"representing a line segment pattern. In this case, the object'swindowstructure will be extracted. -
an object of class
"tess"representing a tessellation. In this case, the object'swindowstructure will be extracted. -
an object of class
"quad"representing a quadrature scheme. In this case, the window of thedatacomponent will be extracted. -
an object of class
"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. -
an object of class
"ppm","kppm","slrm"or"dppm"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. -
an object of class
"lpp"representing a point pattern on a linear network. In this case,as.owinextracts the linear network and returns a window containing this network. -
an object of class
"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. -
A
data.framewith exactly three columns. Each row of the data frame corresponds to one pixel. Each row contains thexandycoordinates of a pixel, and a logical value indicating whether the pixel lies inside the window. -
A
data.framewith exactly two columns. Each row of the data frame contains thexandycoordinates of a pixel that lies inside the window. -
an object of class
"distfun","nnfun"or"funxy"representing a function of spatial location, defined on a spatial domain. The spatial domain of the function will be extracted. -
an object of class
"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. -
an object of class
"layered"representing a list of spatial objects. Seelayered. In this case,as.owinwill be applied to each of the objects in the list, and the union of these windows will be returned. -
An object of another suitable class from another package. For full details, see
vignette('shapefiles').
If the argument 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).
When W is a data frame, the argument step
can be used to specify the pixel grid spacing; otherwise, the spacing
will be guessed from the data.
Value
An object of class "owin" (see owin.object)
specifying an observation window.
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.
See Also
as.owin,
as.owin.rmhmodel,
as.owin.lpp.
Additional methods for as.owin may be provided
by other packages outside the spatstat family.
Examples
te <- quadrat.test(redwood, nx=3)
as.owin(te)