as.data.frame.owin | R Documentation |
Converts a window object to a data frame.
## S3 method for class 'owin'
as.data.frame(x, ..., drop=TRUE)
x |
Window (object of class |
... |
Further arguments passed to
|
drop |
Logical value indicating whether to discard pixels that are
outside the window, when |
This function returns a data frame specifying the coordinates of the window.
If x
is a binary mask window,
the result is a data frame with columns x
and y
containing the spatial coordinates of each pixel.
If drop=TRUE
(the default), only pixels inside the window are retained.
If drop=FALSE
, all pixels are retained, and the data frame has
an extra column inside
containing the logical value of each pixel
(TRUE
for pixels inside the window, FALSE
for outside).
If x
is a rectangle or a polygonal window,
the result is a data frame with columns x
and y
containing the spatial coordinates of the vertices of the
window. If the boundary consists of several polygons, the data frame
has additional columns id
, identifying which polygon is being
traced, and sign
, indicating whether the polygon is an
outer or inner boundary (sign=1
and sign=-1
respectively).
A data frame with columns named x
and y
,
and possibly other columns.
.
as.data.frame.im
,
as.owin.data.frame
as.data.frame(square(1))
holey <- owin(poly=list(
list(x=c(0,10,0), y=c(0,0,10)),
list(x=c(2,2,4,4), y=c(2,4,4,2))))
as.data.frame(holey)
M <- as.mask(holey, eps=0.5)
Mdf <- as.data.frame(M)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.