focalMat | R Documentation |
Make a focal ("moving window") weight matrix for use in the focal
function. The sum of the values adds up to one.
focalMat(x, d, type=c('circle', 'Gauss', 'rectangle'), fillNA=FALSE)
x |
SpatRaster |
d |
numeric. If |
type |
character indicating the type of filter to be returned |
fillNA |
logical. If |
matrix that can be used with focal
r <- rast(ncols=180, nrows=180, xmin=0)
focalMat(r, 2, "circle")
focalMat(r, c(2,3), "rect")
# Gaussian filter for square cells
gf <- focalMat(r, 1, "Gauss")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.