Zoomable state maps made with leaflet

mxstate_leaflet(
df,
pal,
fillColor,
popup,
weight = 0.2,
color = "#555555",
opacity = 1,
fillOpacity = 0.8,
lng = -102,
lat = 23.8,
mapzoom = 5,
zoom = NULL
)

## Arguments

df A data.frame with a column named "region" and a column named "value". Elements in the "region" column must exactly match how regions are named in the "region" column in ?df_mxstate. the color palette function, generated from colorNumeric(), colorBin(), colorQuantile(), or colorFactor() the values used to generate colors from the palette function The text to show when the user clicks on a map feature The thickness of map feature borders The border color for the map features the opacity of colors. The opacity of the colors used to fill the map features The longitude of the map center The latitude of the map center The zoom level The states to zoom into

A leaflet map

## Examples

if (FALSE) {
library(scales)
library(leaflet)

data(df_mxstate)
df_mxstate$value <- df_mxstate$afromexican / df_mxstate$pop pal <- colorNumeric("Blues", domain = df_mxstate$value)
mxstate_leaflet(df_mxstate,
pal,
~ pal(value),
~ sprintf("State: %s<br/>Value: %s",
state_name, comma(value))) %>%
addLegend(position = "bottomright", pal = pal, values = df_mxstate\$value) %>%