| kde {SpatialKDE} | R Documentation |
Kernel Density Estimation
Description
KDE for spatial data. The algorithm is heavily inspired by Heatmap tool in QGIS. The help for QGIS tools is provided at the QGIS website. The a tutorial is provided here.
Usage
kde(
points,
band_width,
decay = 1,
kernel = c("quartic", "uniform", "triweight", "epanechnikov", "triangular"),
scaled = FALSE,
weights = c(),
grid,
cell_size,
quiet = FALSE
)
Arguments
points |
|
band_width |
|
decay |
|
kernel |
|
scaled |
|
weights |
|
grid |
either |
cell_size |
|
quiet |
Should printing of progress bar be suppressed? Default 'FALSE'. |
Details
grid parameter specifies output of the function. KDE is calculated on the specified grid.
If grid is Raster-class then outcome is also Raster-class.
If grid is sf data.frame then outcome is also sf data.frame.
Value
either sf data.frame or Raster-class
depending on class of grid parameter.
Examples
library(sf)
nc <- st_read(system.file("shape/nc.shp", package = "sf")) %>% st_transform(32031)
grid <- create_grid_hexagonal(nc, cell_size = 100000)
points <- st_sample(nc, 500) %>% st_as_sf()
kde_estimate_grid <- kde(points, band_width = 150000, grid = grid)
raster <- create_raster(nc, cell_size = 100000)
kde_estimate_raster <- kde(points, band_width = 150000, grid = raster)