Load libraries

library(leaflet) library(sp)

Load your CSV

biketheft <- read.csv(“biketheft.csv”)

Make sure coordinates are numeric

biketheft\(Longitude <- as.numeric(biketheft\)Longitude) biketheft\(Latitude <- as.numeric(biketheft\)Latitude)

Create the map

m <- leaflet(biketheft) %>% addTiles() %>% addMarkers( lng = ~Longitude, lat = ~Latitude, clusterOptions = markerClusterOptions(showCoverageOnHover = FALSE), popup = ~paste( “Neighborhood:”, Neighbourhood, “
Address:”, Hundred_Block, “
Date:”, Date, “
Time:”, Time ) ) %>% addControl( position = “bottomright”, html = “

Author: Clara Morin
Data Source: VPD Data Portal (2022)
GEOS 372 | Lab Section L2B

” ) %>% addLegend( position = “bottomright”, colors = c(“#91d467”,“#ebc83d”,“#f68f42”), labels = c(“< 10”, “< 100”, “100+”), opacity = 1, title = “Number of Bike Thefts” )

Render the map

m