NA.
New values are computed with function fun, using the values of the cells in the neigborhood of a focal cell (including the focal cell).focal_old(x, ngb=3, fun=mean, na.rm=TRUE, filename="", ...)
focalNA(x, ngb=3, fun=mean, recursive=FALSE, maxrec=0, filename="", ...)ngb=3 refers to 2 cells at each side of the focal cell, queen's case, 9 cells in total. This is equivalent lengtTRUE, NA will be removed from focal computations. The result will only be NA if all focal cells are NATRUE, the function will continue recursively untill there are no more cells with NArecursive=TRUE)overwrite Logical. If TRUE, "filename" will be overwritten if it exists
format Character. Output file type. See writeRaster
datatype Character. Output data type. See dataType
progress Character. "text", "window", or "" (the default, no progress bar)
}focalr <- raster(ncols=36, nrows=18)
r[] <- runif(ncell(r))
rf <- focal_old(r, fun=mean, ngb=3)Run the code above in your browser using DataLab