kdestimate: Kernel density estimation for spatial point pattern

View source: R/density.R

kdestimateR Documentation

Kernel density estimation for spatial point pattern

Description

Wrapper around spatstat functions. Kernel density is estimated for a point pattern in a given window for different levels of a categorical variable.

Usage

kdestimate(x, mask, markscol, lvls, sigma = 4000, points = TRUE)

Arguments

x

sf object of geometry type POINTS in projected CRS.

mask

Single sf polygon, the study window.

markscol

Column name of x to use as grouping variable.

lvls

Vector of levels of markscol.

sigma

Standard deviation of isotropic smoothing kernel. Numeric value, passed to spatstat::density.splitppp function. Scale depends on coordinate reference system, for S-JTSK (EPSG 5514) it is in meters and defaults to 4 km.

points

Logical, return value for points or whole surface as raster image. Defaults to TRUE.

Value

With points set to TRUE (default) returns a tibble with KDE estimated at given points. If set to FALSE, a tibble with KDE values in a grid is returned to be plotted using ggplot2.


petrpajdla/settlements documentation built on June 27, 2022, 10:21 p.m.