Leaflet map with proportional circles of arbovirus cases by locality, state and municipal boundaries, and a panel with the localities with the most cases. Clicking a row of the panel zooms the map to that locality.

mp_cases_loc(
  data,
  var = "probable",
  top_n = 10,
  title = "Casos Probables",
  palette = "D",
  r_min = 4,
  r_max = 20,
  cve_edo = NULL,
  mun_boundaries = TRUE,
  edo_boundaries = TRUE,
  table_position = "topright"
)

Arguments

data

sf object returned by [cases_by_loc()]. To map specific epidemiological weeks, filter them there with its `week` argument (e.g. `cases_by_loc(..., week = 1:10)`).

var

name of the column to map (default `"probable"`; also `"confirmado"`, `"DNG"`, `"DCSA"`, `"DG"`, `"DENV1"`, ...).

top_n

number of localities shown in the panel (default 10). With more than 20, the panel shows 20 rows and a scroll bar.

title

title of the legend and the panel (default `"Casos Probables"`).

palette

viridis option for the circles (default `"D"`).

r_min, r_max

minimum and maximum radius of the circles in pixels.

cve_edo

INEGI state code ("14" or 14). If NULL (default), the whole country is mapped.

mun_boundaries

logical. Draw the municipal boundaries (`rgeomex::AGEM_inegi19_mx`). Default TRUE.

edo_boundaries

logical. Draw the state boundaries (`rgeomex::AGEE_inegi19_mx`). Default TRUE.

table_position

position of the panel: `"topright"` (default), `"topleft"`, `"bottomleft"` or `"bottomright"`.

Value

a leaflet htmlwidget.

Details

Boundaries are drawn below the circles and can be turned on and off from the layers control. Hovering over a municipality shows its name. The home button returns to the state (if `cve_edo` is given) or to Mexico.

Author

Felipe Antonio Dzul Manzanilla felipe.dzul.m@gmail.com

Examples

if (FALSE) { # \dontrun{
den <- cases_by_loc(path = "DENGUE2_.txt", snv_dataset = "DENV")
mp_cases_loc(den)

# Oaxaca, weeks 1 to 10, confirmed cases
den_w <- cases_by_loc(path = "DENGUE2_.txt", snv_dataset = "DENV",
                      week = 1:10)
mp_cases_loc(den_w, var = "confirmado", title = "Casos Confirmados",
             cve_edo = "20", top_n = 15)
} # }