Modified from leafletCN::geojsonMap()

geojsonMap_legendless(dat, mapName, namevar=NULL, valuevar=NULL,
  palette = "Blues", colorMethod = "numeric",
  na.color = "#808080", popup = NULL, stroke = T, smoothFactor = 1,
   weight = 1, fillOpacity = 0.7, tileType, ...)

Arguments

dat

a data.frame contain regions and values

mapName

mapName for loading, eg. 'china', 'city', ...

namevar

a formula show which feature is chosen for name variable

valuevar

a formula show which feature is chosen for value variable

palette

The colors or color function that values will be mapped to, see RColorBrewer::display.brewer.all()

colorMethod

set one of the coloe mapping in c("numeric", "bin", "quantile", "Factor")

na.color

The color to return for NA values. Note that na.color=NA is valid.

popup

a character vector of the HTML content for the popups (you are recommended to escape the text using htmlEscape() for security reasons)

stroke

whether to draw stroke along the path (e.g. the borders of polygons or circles)

smoothFactor

how much to simplify the polyline on each zoom level (more means better performance and less accurate representation)

weight

stroke width in pixels

fillOpacity

fill opacity

tileType

function to define tile like amap or leaflet::addTiles

...

other paramter pass to the color mapping function

Examples

dat = data.frame(name = regionNames("china"), value = runif(35))
#> Error in regionNames("china"): could not find function "regionNames"
geojsonMap(dat, "china")
#> Error in geojsonMap(dat, "china"): could not find function "geojsonMap"
dat$value2 = cut(dat$value, c(0, 0.25, 0.5, 1))
#> Error in cut(dat$value, c(0, 0.25, 0.5, 1)): object 'dat' not found
geojsonMap(dat, "china", namevar = ~name, valuevar = ~value2, palette = "Reds", colorMethod = "factor")
#> Error in geojsonMap(dat, "china", namevar = ~name, valuevar = ~value2, palette = "Reds", colorMethod = "factor"): could not find function "geojsonMap"
geojsonMap(dat, "china", namevar = ~name, valuevar = ~value2, palette = topo.colors(3), colorMethod = "factor")
#> Error in geojsonMap(dat, "china", namevar = ~name, valuevar = ~value2, palette = topo.colors(3), colorMethod = "factor"): could not find function "geojsonMap"