2 Election Map

pal <- colorFactor("RdBu", metadataGIS$pctGOPcategories, reverse=TRUE)

leaflet(metadataGIS, options = leafletOptions(crsClass = "L.CRS.EPSG3857"), width="100%") %>%
  addPolygons(weight = 0.5, color = "gray", opacity = 0.7,
    fillColor = ~pal(pctGOPcategories), fillOpacity = 1, smoothFactor = 0.5,
    label = popupLabels,
    labelOptions = labelOptions(direction = "auto")) %>%
    addPolygons(data = stateGIS,fill = FALSE,color="black",weight = 1) %>%
    addLegend(pal = pal,values = ~metadataGIS$pctGOPcategories, opacity = 1, title = "% Trump",position = "bottomright")