My baseline strategy for spatial data in R is to get it into sf objects as fast as possible.
You can read geoJSON links directly with sf::read_sf()
library(sf)
sf <- read_sf(
"https://raw.githubusercontent.com/amalabdi/milestone_8/master/counties.geojson")
Picking out a good color column and a pretty palette:
library(leaflet)
pal_val <- sf$er.03
pal <- colorNumeric("viridis", pal_val)
Then just stack it all together, with some nice map tiles for flair.
leaflet(sf) %>%
addProviderTiles(providers$Stamen.Toner) %>%
addPolygons(color = ~pal(pal_val),
fillColor = ~pal(pal_val)) %>%
addLegend(pal = pal, values = pal_val)
