focalWeight | R Documentation |
Calculate focal ("moving window") weight matrix for use in the focal
function. The sum of the values adds up to one.
focalWeight(x, d, type=c('circle', 'Gauss', 'rectangle'), fillNA=FALSE)
x |
Raster* object |
d |
numeric. If |
type |
character indicating the type of filter to be returned |
fillNA |
logical. If |
matrix that can be used in focal
r <- raster(ncols=180, nrows=180, xmn=0, crs="+proj=utm +zone=1")
# Gaussian filter for square cells
gf <- focalWeight(r, .5, "Gauss")
focalWeight(r, 2, "circle", fillNA=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.