spatstat (version 1.7-12)

as.owin: Convert Data To Class owin

Description

Converts data specifying an observation window in any of several formats, into an object of class "owin".

Usage

as.owin(W)

Arguments

W
Data specifying an observation window, in any of several formats described under Details below.

Value

  • An object of class "owin" (see owin.object) specifying an observation window.

Details

The class "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 spatstat package. The argument W may be
  • an object of class"owin"
  • a structure with entriesxrange,yrangespecifying the$x$and$y$dimensions of a rectangle
  • a four-element vector (interpreted as(xmin, xmax, ymin, ymax)) specifying the$x$and$y$dimensions of a rectangle
  • a structure with entriesxl,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 Ripleyspatiallibrary.
  • an object of class"ppp"representing a point pattern. In this case, the object'swindowstructure 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.

See Also

owin.object, owin

Examples

Run this code
w <- 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 DataCamp Workspace