kde_map: 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)
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.
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.
#Using provided dataset from Chicago Data Portal:data(crimes)
crimes <- head(crimes, 1000)
library('leaflet') # needed to install basemap providerskde_map(crimes)