The map created in this assignment contains data of 7,584 crime records from Sacramento Crime January 2006 dataset and made available bythe Sacramento Police Department. accessed from the following link(http://samplecsvs.s3.amazonaws.com/SacramentocrimeJanuary2006.csv )

Reading Data

Reading data from the given url and subsetting to extract 800 random samples out of the 7000+ records.

data <- "http://samplecsvs.s3.amazonaws.com/SacramentocrimeJanuary2006.csv"
df <- read.csv(url(data))
df <- df[sample(nrow(df), 800), c(8,9)]

Plotting Map

The map below shows a clustered view of all the spots where crimes were recorded by the Sacremento Police Department in 2006.

library(leaflet)
df %>%
  leaflet() %>%
  addTiles() %>%
  addMarkers(clusterOptions = markerClusterOptions())