as.owin: Convert Data To Class owin

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/window.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 as.owin(W, ..., fatal=TRUE)

 ## Default S3 method:
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'owin'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'ppp'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'psp'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'quad'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'quadratcount'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'tess'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'im'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'layered'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'data.frame'
as.owin(W, ..., step, fatal=TRUE)

 ## S3 method for class 'distfun'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'nnfun'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'funxy'
as.owin(W, ..., fatal=TRUE)

 ## S3 method for class 'boxx'
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.

step

Optional. A single number, or numeric vector of length 2, giving the grid step lengths in the x and y directions.

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

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)

\spatstatAuthors

.

See Also

owin.object, owin.

Additional methods for as.owin are provided in the maptools package: as.owin.SpatialPolygon, as.owin.SpatialPolygons, as.owin.SpatialPolygonsDataFrame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 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
 spatialpath <- system.file(package="spatial")
 if(nchar(spatialpath) > 0) {
   require(spatial)
   towns <- ppinit("towns.dat")
   w <- as.owin(towns)
   detach(package:spatial)
 }

spatstat.geom documentation built on April 15, 2021, 9:06 a.m.