library(leafletjs)
library(maps)
library(sp)
library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
stateMap <- map("state", plot = FALSE, fill = TRUE)
stateData <- data.frame(
  name = stateMap$names,
  party = factor(ifelse(runif(length(stateMap$names)) < 0.5, "Democrat", "Republican")),
  population = runif(length(stateMap$names), min=100000, max = 20000000)
)

dpal <- newCategoricalPalette(c("blue", "red"), domain = c("Democrat", "Republican"))
leaflet(stateMap) %>% addTiles() %>%
  addPolygons(weight = 1, color = dpal(stateData$party))

Leaflet | © OpenStreetMap contributors, CC-BY-SA

cpal <- newContinuousPalette("BuPu")
leaflet(stateMap) %>%
  addPolygons(smoothFactor = 0.2, stroke = FALSE, fillOpacity = 1, fillColor = cpal(stateData$population))