When you add a huge number of marker on your leaflet map, it is important to allow their clusterisation: they will be grouped by zone, and these groups will change when you zoom. It highly improves the user experience since it avoids the map lags when you zoom or move. It is really easy to use this feature: just add markerClusterOptions() when you build the markers!
# Load libraries
# Make data with 1000 random positions
data=data.frame(LONG=42+rnorm(1000), LAT=23+rnorm(1000), PLACE=paste("place",seq(1,1000)))
# Initialize the leaflet map:
setView(lng=42, lat=23, zoom=8 ) %>%
# Add two tiles
addTiles(options = providerTileOptions(noWrap = TRUE)) %>%
# Add 2 marker groups
addCircleMarkers(data=data, lng=~LONG , lat=~LAT, radius=8 , color="black", fillColor="red", stroke = TRUE, fillOpacity = 0.8, clusterOptions = markerClusterOptions())
Not what you are looking for ? Make a new search !