# \donttest{
library(sf)
library(terra)
data(meuse, package = "sp")
meuse <- st_as_sf(meuse, coords = c("x", "y"), crs = 28992,
agr = "constant")
# Unweighted KDE (spatial locations only) with 40m resoultion
pt.kde <- sf.kde(x = meuse, bw = 1000, standardize = TRUE, res=40)
plot(pt.kde, main="Unweighted kde")
plot(st_geometry(meuse), pch=20, col="red", add=TRUE)
# cadmium weighted KDE usign extent with 40m resoultion and 500m and 1000m bw
cadmium.kde.500 <- sf.kde(x = meuse, y = meuse$cadmium, res=40,
bw = 500, standardize = TRUE)
cadmium.kde.1000 <- sf.kde(x = meuse, y = meuse$cadmium, res=40,
bw = 1000, standardize = TRUE)
plot(c(cadmium.kde.500, cadmium.kde.1000))
# }
Run the code above in your browser using DataLab