library(terra)
elev <- rast(system.file("extdata/elev.tif", package="spatialEco"))
# Gaussian smoothing with sigma = 2 and 7x7 window
g1 <- raster.gaussian.smooth(elev, s = 2, n = 7)
plot(c(elev,g1))
# g1 <- raster.gaussian.smooth(elev, s = 2, n = 7, type = "convolution")
Run the code above in your browser using DataLab