kde_map | R Documentation |
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.
kde_map(data, pts = NULL)
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 |
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.
Jamie Spaulding, Keith Morris
#Using provided dataset from Chicago Data Portal:
data(crimes)
crimes <- head(crimes, 1000)
library('leaflet') # needed to install basemap providers
kde_map(crimes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.