kde_map: Kernel Density Estimation and Heat Map Generation for Crime...

View source: R/kde_map.R

kde_mapR Documentation

Kernel Density Estimation and Heat Map Generation for Crime Incidents

Description

This function computes a kernel density estimate of crime incident locations and returns a 'Leaflet' map of the incidents. The data is based on the Chicago Police Department RMS structure and populates pop-up windows with the incident location for each incident.

Usage

kde_map(data, pts = NULL)

Arguments

data

Data frame of crime or RMS data. See provided Chicago Data Portal example for reference

pts

Either true or false. Dictates whether the incident points will be plotted on the map widget. If NULL, the default value is TRUE.

Value

A Leaflet map with three layers: an 'ESRI' base-map, all crime incidents plotted (with incident info pop-up windows), and a kernel density estimate of those points.

Author(s)

Jamie Spaulding, Keith Morris

Examples

#Using provided dataset from Chicago Data Portal:
data(crimes)
crimes <- head(crimes, 1000)
library('leaflet') # needed to install basemap providers
kde_map(crimes)

rcrimeanalysis documentation built on May 31, 2023, 8:54 p.m.