Last chance! 50% off unlimited learning
Sale ends in
raster.x(w, drop=FALSE)
raster.y(w, drop=FALSE)
raster.xy(w, drop=FALSE)
"owin"
)
of type "mask"
representing a binary pixel image.TRUE
, then coordinates of pixels that lie outside the
window are removed.
If FALSE
(the default) then the coordinates of every
pixel in the containing rectangle are retained.raster.xy
returns a list with components x
and y
which are numeric vectors of equal length containing the pixel coordinates. If drop=FALSE
,
raster.x
and raster.y
return
a matrix of the same dimensions as the pixel grid in w
,
and giving the value of the $x$ (or $y$) coordinate
of each pixel in the raster.
If drop=TRUE
,
raster.x
and raster.y
return numeric vectors.
w
should be a window (an object of class
"owin"
, see owin.object
for details).
A window of type "mask"
represents a binary pixel image. If drop=FALSE
(the default), the
functions raster.x
and raster.y
return
a matrix of the same dimensions as the
binary pixel image itself, with entries giving the $x$ coordinate
(for raster.x
) or $y$ coordinate (for raster.y
)
of each pixel in the binary image.
If drop=TRUE
, pixels that lie outside the
window w
are removed, and raster.x
and raster.y
return numeric vectors containing the coordinates of the
pixels that are inside the window w
.
The function raster.xy
returns a list
with components x
and y
which are numeric vectors of equal length containing the pixel coordinates.
owin
,
as.mask
,
pixelcentres
u <- owin(c(-1,1),c(-1,1)) # square of side 2
w <- as.mask(u, eps=0.01) # 200 x 200 grid
X <- raster.x(w)
Y <- raster.y(w)
disc <- owin(c(-1,1), c(-1,1), mask=(X^2 + Y^2 <= 1))
plot(disc)
# approximation to the unit disc
Run the code above in your browser using DataLab