Chapter 17 Map the Crime Sites

center_lon = median(LACrime$longitude,na.rm = TRUE)
center_lat = median(LACrime$latitude,na.rm = TRUE)

LACrimeSample = LACrime %>% sample_n(50e3)

leaflet(LACrimeSample) %>% addProviderTiles("Esri.NatGeoWorldMap") %>%
  addCircles(lng = ~longitude, lat = ~latitude, 
             color = c("red"))  %>%
  # controls
  setView(lng=center_lon, lat=center_lat, zoom=10)

We observe that there are clusters of areas where Crime happens. Areas like Burbank, Santa Monica, Rancho Palos Verdes,Redondo Beach have less crimes or no crimes at all.