d: numeric. If type=circle, the radius of the circle (in units of the CRS). If type=rectangle the dimension of the rectangle (one or two numbers). If type=Gauss the size of sigma, and optionally another number to determine the size of the matrix returned (default is 3 times sigma)
type: character indicating the type of filter to be returned
fillNA: logical. If TRUE, zeros are set to NA such that they are ignored in the computations. Only applies to type="circle"
Returns
matrix that can be used in focal
Examples
r <- raster(ncols=180, nrows=180, xmn=0, crs="+proj=utm +zone=1")# Gaussian filter for square cellsgf <- focalWeight(r,.5,"Gauss")focalWeight(r,2,"circle", fillNA=TRUE)