Philadelphia Crime Map

this assignment allows us to visualize crime on the map of philadelphia. Being able to spatially understand the crime distribution across philadelphia better shows clusters of crime in specific areas.

library(tidyverse)
library(leaflet)

set.seed(1)

crime <- data.frame(
  lat = rnorm(200,39.9526,0.02),
  lon = rnorm(200,-75.1652,0.02)
)

leaflet(crime) %>%
  addTiles() %>%
  setView(lng = -75.1652, lat = 39.9526, zoom = 11) %>%
  addCircleMarkers(
    lng = ~lon,
    lat = ~lat,
    radius = 4,
    color = "red",
    stroke = FALSE,
    fillOpacity = 0.7
  )