Dengue Cases Report of 6 October in Bangladesh
## Dengue Cases Report of 6 October in Bangladesh
# R Script to Create an Interactive Map of Dengue Cases by District
# This map uses the 'leaflet' package to display circular markers scaled by Total Admitted Cases
# at the more granular District (Zila) level.
# -----------------------------------------------------------
# 1. Setup and Load Libraries
# -----------------------------------------------------------
# Install packages if you haven't already (uncomment the line below to run)
# install.packages(c("tidyverse", "readr", "dplyr", "leaflet", "scales"))
# Load the required libraries
library(readr)
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
library(leaflet) # For interactive mapping
library(scales) # For number formatting in tooltips
##
## Attaching package: 'scales'
## The following object is masked from 'package:readr':
##
## col_factor
# -----------------------------------------------------------
# 2. Data Loading and Preparation
# -----------------------------------------------------------
file_path <- "C:/Users/ashik/Downloads/Dengue_Report_Bangladesh_06Oct2025.csv"
dengue_data <- read_csv(file_path)
## Rows: 60 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): District/Division, Remarks
## dbl (4): New Admissions (24h), Total Admitted, Deaths, Discharged
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# 2.1 Clean Column Names and Filter for Districts
dengue_districts_raw <- dengue_data %>%
rename(
Location = `District/Division`,
TotalAdmitted = `Total Admitted`,
Deaths = Deaths
) %>%
# Filter OUT the high-level 'Division' summary rows to keep only Districts
filter(!grepl(" Division", Location)) %>%
# Clean up the location names (e.g., replace 'Chattogram' with 'Chittagong' if needed
# for merging, but we will rely on case-insensitive joining if possible)
mutate(
District = Location,
# Convert key columns to numeric, coercing errors to NA
TotalAdmitted = as.numeric(TotalAdmitted),
Deaths = as.numeric(Deaths)
) %>%
# Select only the columns we need
select(District, TotalAdmitted, Deaths)
# Remove NA values after conversion
dengue_districts <- dengue_districts_raw %>%
filter(!is.na(TotalAdmitted) & !is.na(Deaths)) %>%
# Standardize a few common name discrepancies for robust merging
mutate(District = case_when(
District == "Chattogram" ~ "Chittagong",
District == "Barishal" ~ "Barisal",
District == "Jashore" ~ "Jessore",
District == "Cox’s Bazar" ~ "Cox's Bazar",
TRUE ~ District # Keep all others as is
))
# -----------------------------------------------------------
# 3. Geo-Coordinates for Districts (64 Districts)
# -----------------------------------------------------------
# Coordinates for all 64 District Headquarters of Bangladesh (Approximate Centers)
district_coords <- data.frame(
District = c("Dhaka", "Gazipur", "Narayanganj", "Narsingdi", "Tangail", "Kishoreganj", "Shariatpur", "Manikganj", "Munshiganj", "Faridpur", "Rajbari", "Madaripur", "Gopalganj",
"Chittagong", "Cox's Bazar", "Bandarban", "Khagrachhari", "Cumilla", "Feni", "Lakshmipur", "Chandpur", "Brahmanbaria",
"Khulna", "Jessore", "Jhenaidah", "Bagerhat", "Narail", "Kushtia", "Chuadanga", "Meherpur",
"Rajshahi", "Bogra", "Pabna", "Natore", "Naogaon", "Chapai Nawabganj", "Sirajganj", "Joypurhat",
"Rangpur", "Dinajpur", "Gaibandha", "Kurigram", "Lalmonirhat", "Nilphamari", "Panchagarh", "Thakurgaon",
"Sylhet", "Sunamganj", "Habiganj", "Moulvibazar",
"Barisal", "Patuakhali", "Bhola", "Pirojpur", "Barguna", "Jhalokati",
"Mymensingh", "Jamalpur", "Netrokona", "Sherpur"),
lat = c(23.7115, 24.0023, 23.6360, 24.1340, 24.4265, 24.4372, 23.2423, 23.8617, 23.5186, 23.6062, 23.7151, 23.1678, 23.0039,
22.3571, 21.4278, 22.1979, 23.0560, 23.4618, 23.0159, 22.9447, 23.2329, 23.9608,
22.8167, 23.1634, 23.5448, 22.6582, 23.1818, 23.9061, 23.6333, 23.8049,
24.3750, 24.8465, 24.0044, 24.4102, 24.8398, 24.7170, 24.4533, 25.0934,
25.7483, 25.6279, 25.3297, 25.8072, 25.9923, 25.8483, 26.3776, 26.0357,
24.8945, 25.0715, 24.4771, 24.3095,
22.7010, 22.3598, 22.3276, 22.5791, 22.0953, 22.5721,
24.7533, 24.8643, 24.8103, 25.0746),
lon = c(90.4125, 90.3855, 90.4998, 90.7860, 89.9113, 90.9821, 90.4348, 90.0003, 90.4127, 89.8461, 89.5875, 90.1870, 89.9866,
91.8123, 92.0077, 92.2104, 91.9790, 91.1869, 91.3976, 90.8282, 90.8655, 91.1115,
89.5403, 89.2182, 89.1726, 89.7895, 89.5075, 89.1099, 88.8553, 88.8021,
88.6014, 89.3701, 89.2562, 89.0076, 88.9412, 88.2917, 89.7001, 89.0945,
89.2752, 88.6332, 89.5430, 89.6295, 89.2847, 88.9414, 88.5952, 88.4283,
91.8680, 91.3992, 91.4507, 91.7315,
90.3533, 90.3541, 90.7101, 89.9759, 90.1121, 90.1870,
90.4070, 89.9490, 90.8732, 90.1884)
)
# -----------------------------------------------------------
# 4. Join Data
# -----------------------------------------------------------
# Merge dengue data with coordinates
dengue_map_data <- left_join(district_coords, dengue_districts, by = "District") %>%
# Remove districts not found or with NA data (i.e., districts not in the provided CSV)
filter(!is.na(TotalAdmitted))
# -----------------------------------------------------------
# 5. Create Leaflet Map
# -----------------------------------------------------------
# Define color palette based on Total Admitted cases
pal <- colorNumeric(
palette = "YlOrRd", # Using a Yellow-Orange-Red gradient for better distinction
domain = dengue_map_data$TotalAdmitted
)
# Calculate a radius for the circles proportional to the cases (for visual effect)
max_cases <- max(dengue_map_data$TotalAdmitted, na.rm = TRUE)
# Adjust the scaling factor to keep markers visible but not overwhelming
dengue_map_data$radius <- sqrt(dengue_map_data$TotalAdmitted) / sqrt(max_cases) * 35
# Create the map
dengue_map <- leaflet(dengue_map_data) %>%
# Add default map tiles (OpenStreetMap)
addTiles() %>%
# Set the view over the center of Bangladesh
setView(lng = 90.399, lat = 23.68, zoom = 7) %>%
# Add proportional circle markers
addCircleMarkers(
lng = ~lon,
lat = ~lat,
radius = ~radius,
stroke = TRUE,
weight = 1,
color = "#333333",
fillOpacity = 0.8, # Slightly higher opacity for district data
fillColor = ~pal(TotalAdmitted), # Color based on the count
# Add a popup with detailed information on click
popup = ~paste0(
"<strong>", District, " District</strong><br/>",
"Total Admitted: ", scales::comma(TotalAdmitted), "<br/>",
"Total Deaths: ", Deaths
),
# Add a label that appears on hover
label = ~paste0(District, ": ", scales::comma(TotalAdmitted), " Cases"),
labelOptions = labelOptions(noHide = F, direction = "auto")
) %>%
# Add a title
addControl(
html = paste0(
"<div style='background-color: white; padding: 6px; border-radius: 4px; opacity: 0.9;'>",
"<strong>Dengue Cases by District (Oct 2025)</strong>",
"</div>"
),
position = "topright"
) %>%
# Add a legend
addLegend(
pal = pal,
values = ~TotalAdmitted,
title = "Total Admitted Cases",
position = "bottomright",
labFormat = labelFormat(big.mark = ",") # Use comma formatting for numbers
)
# Print the map
print(dengue_map)
cat("\n--- R Script Execution Complete ---\n")
##
## --- R Script Execution Complete ---
cat("An interactive map object 'dengue_map' was created using the leaflet package.\n")
## An interactive map object 'dengue_map' was created using the leaflet package.
cat("Run 'print(dengue_map)' in your R console or RStudio viewer to see the visualization.\n")
## Run 'print(dengue_map)' in your R console or RStudio viewer to see the visualization.
Dengue Cases Reports of this week in Bangladesh
## Dengue Cases Reports of this week in Bangladesh
# R Script to Create an Interactive Map of Dengue Cases by District
# This map uses the 'leaflet' package to display circular markers scaled by Total Admitted Cases
# at the more granular District (Zila) level.
# -----------------------------------------------------------
# 1. Setup and Load Libraries
# -----------------------------------------------------------
# Install packages if you haven't already (uncomment the line below to run)
# install.packages(c("tidyverse", "readr", "dplyr", "leaflet", "scales"))
# Load the required libraries
library(readr)
library(dplyr)
library(leaflet) # For interactive mapping
library(scales) # For number formatting in tooltips
# -----------------------------------------------------------
# 2. Data Loading and Preparation
# -----------------------------------------------------------
# *** UPDATED: Using the new CSV file provided by the user ***
file_path <- "C:/Users/ashik/Downloads/Dengue_Cases_Bangladesh_Districts_06Oct2025.csv"
dengue_data <- read_csv(file_path)
## Rows: 51 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): District, Division, Remarks
## dbl (2): Total Cases (2025), Deaths
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# 2.1 Clean Column Names and Filter for Districts
dengue_districts_raw <- dengue_data %>%
# Rename the main case count column to "TotalAdmitted" for consistent use in the plotting logic
rename(
TotalAdmitted = `Total Cases (2025)`
) %>%
# Filter out the summary row for Dhaka (City + Outskirts) as it overlaps with individual district data
filter(District != "Dhaka (City + Outskirts)") %>%
mutate(
# Convert key columns to numeric, coercing errors to NA
TotalAdmitted = as.numeric(TotalAdmitted),
Deaths = as.numeric(Deaths)
) %>%
# Select only the columns we need
select(District, TotalAdmitted, Deaths)
# Remove NA values after conversion
dengue_districts <- dengue_districts_raw %>%
filter(!is.na(TotalAdmitted) & !is.na(Deaths)) %>%
# Standardize district names to match the geo-coordinate list for robust merging
mutate(District = case_when(
# Handle known naming variations
District == "Chattogram" ~ "Chittagong",
District == "Barishal" ~ "Barisal",
District == "Jashore" ~ "Jessore",
District == "Cox’s Bazar" ~ "Cox's Bazar", # Standardizing the apostrophe
TRUE ~ District # Keep all others as is
))
# -----------------------------------------------------------
# 3. Geo-Coordinates for Districts (64 Districts)
# -----------------------------------------------------------
# Coordinates for all 64 District Headquarters of Bangladesh (Approximate Centers)
# NOTE: This list is static and covers all 64 districts for accurate placement.
district_coords <- data.frame(
District = c("Dhaka", "Gazipur", "Narayanganj", "Narsingdi", "Tangail", "Kishoreganj", "Shariatpur", "Manikganj", "Munshiganj", "Faridpur", "Rajbari", "Madaripur", "Gopalganj",
"Chittagong", "Cox's Bazar", "Bandarban", "Khagrachhari", "Cumilla", "Feni", "Lakshmipur", "Chandpur", "Brahmanbaria",
"Khulna", "Jessore", "Jhenaidah", "Bagerhat", "Narail", "Kushtia", "Chuadanga", "Meherpur",
"Rajshahi", "Bogra", "Pabna", "Natore", "Naogaon", "Chapai Nawabganj", "Sirajganj", "Joypurhat",
"Rangpur", "Dinajpur", "Gaibandha", "Kurigram", "Lalmonirhat", "Nilphamari", "Panchagarh", "Thakurgaon",
"Sylhet", "Sunamganj", "Habiganj", "Moulvibazar",
"Barisal", "Patuakhali", "Bhola", "Pirojpur", "Barguna", "Jhalokati",
"Mymensingh", "Jamalpur", "Netrokona", "Sherpur"),
lat = c(23.7115, 24.0023, 23.6360, 24.1340, 24.4265, 24.4372, 23.2423, 23.8617, 23.5186, 23.6062, 23.7151, 23.1678, 23.0039,
22.3571, 21.4278, 22.1979, 23.0560, 23.4618, 23.0159, 22.9447, 23.2329, 23.9608,
22.8167, 23.1634, 23.5448, 22.6582, 23.1818, 23.9061, 23.6333, 23.8049,
24.3750, 24.8465, 24.0044, 24.4102, 24.8398, 24.7170, 24.4533, 25.0934,
25.7483, 25.6279, 25.3297, 25.8072, 25.9923, 25.8483, 26.3776, 26.0357,
24.8945, 25.0715, 24.4771, 24.3095,
22.7010, 22.3598, 22.3276, 22.5791, 22.0953, 22.5721,
24.7533, 24.8643, 24.8103, 25.0746),
lon = c(90.4125, 90.3855, 90.4998, 90.7860, 89.9113, 90.9821, 90.4348, 90.0003, 90.4127, 89.8461, 89.5875, 90.1870, 89.9866,
91.8123, 92.0077, 92.2104, 91.9790, 91.1869, 91.3976, 90.8282, 90.8655, 91.1115,
89.5403, 89.2182, 89.1726, 89.7895, 89.5075, 89.1099, 88.8553, 88.8021,
88.6014, 89.3701, 89.2562, 89.0076, 88.9412, 88.2917, 89.7001, 89.0945,
89.2752, 88.6332, 89.5430, 89.6295, 89.2847, 88.9414, 88.5952, 88.4283,
91.8680, 91.3992, 91.4507, 91.7315,
90.3533, 90.3541, 90.7101, 89.9759, 90.1121, 90.1870,
90.4070, 89.9490, 90.8732, 90.1884)
)
# -----------------------------------------------------------
# 4. Join Data
# -----------------------------------------------------------
# Merge dengue data with coordinates
dengue_map_data <- left_join(district_coords, dengue_districts, by = "District") %>%
# Remove districts not found or with NA data
filter(!is.na(TotalAdmitted))
# -----------------------------------------------------------
# 5. Create Leaflet Map
# -----------------------------------------------------------
# Define color palette based on Total Admitted cases
pal <- colorNumeric(
palette = "YlOrRd", # Using a Yellow-Orange-Red gradient for better distinction
domain = dengue_map_data$TotalAdmitted
)
# Calculate a radius for the circles proportional to the cases (for visual effect)
max_cases <- max(dengue_map_data$TotalAdmitted, na.rm = TRUE)
# Adjust the scaling factor to keep markers visible but not overwhelming
dengue_map_data$radius <- sqrt(dengue_map_data$TotalAdmitted) / sqrt(max_cases) * 35
# Create the map
dengue_map <- leaflet(dengue_map_data) %>%
# Add default map tiles (OpenStreetMap)
addTiles() %>%
# Set the view over the center of Bangladesh
setView(lng = 90.399, lat = 23.68, zoom = 7) %>%
# Add proportional circle markers
addCircleMarkers(
lng = ~lon,
lat = ~lat,
radius = ~radius,
stroke = TRUE,
weight = 1,
color = "#333333",
fillOpacity = 0.8, # Slightly higher opacity for district data
fillColor = ~pal(TotalAdmitted), # Color based on the count
# Add a popup with detailed information on click
popup = ~paste0(
"<strong>", District, " District</strong><br/>",
"Total Cases (2025): ", scales::comma(TotalAdmitted), "<br/>",
"Total Deaths: ", Deaths
),
# Add a label that appears on hover
label = ~paste0(District, ": ", scales::comma(TotalAdmitted), " Cases"),
labelOptions = labelOptions(noHide = F, direction = "auto")
) %>%
# Add a title
addControl(
html = paste0(
"<div style='background-color: white; padding: 6px; border-radius: 4px; opacity: 0.9;'>",
"<strong>Dengue Cases by District (Oct 2025)</strong>",
"</div>"
),
position = "topright"
) %>%
# Add a legend
addLegend(
pal = pal,
values = ~TotalAdmitted,
title = "Total Cases (2025)",
position = "bottomright",
labFormat = labelFormat(big.mark = ",") # Use comma formatting for numbers
)
# Print the map
print(dengue_map)
cat("\n--- R Script Execution Complete ---\n")
##
## --- R Script Execution Complete ---
cat("An interactive map object 'dengue_map' was created using the leaflet package.\n")
## An interactive map object 'dengue_map' was created using the leaflet package.
cat("Run 'print(dengue_map)' in your R console or RStudio viewer to see the visualization.\n")
## Run 'print(dengue_map)' in your R console or RStudio viewer to see the visualization.
Dengue Cases Report of last Month in Bangladesh
# --- Load libraries ---
library(leaflet)
library(leaflet.extras)
library(dplyr)
library(readr)
library(RColorBrewer)
library(htmltools)
# --- Load the dengue dataset ---
# Using the specified local path. Ensure the file is present.
dengue_data <- read_csv("C:/Users/ashik/Downloads/Dengue_Cases_Bangladesh_Sept2025_with_coords.csv")
## Rows: 35 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): District/City, Division, Remarks
## dbl (6): Cases (Sept 2025), Deaths, Latitude, Longitude, lat, lon
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# ================================================================
# --- CONSOLIDATED DATA CLEANING, PREPARATION, AND SCALING ---
# The previous code had two duplicated 'Clean and prepare data' blocks.
# This section combines and orders the steps correctly.
# ================================================================
# --- Step 1: Clean and prepare base data columns ---
dengue_data <- dengue_data %>%
mutate(
Cases = `Cases (Sept 2025)`,
District = `District/City`,
Deaths = Deaths,
Division = Division,
Remarks = Remarks
)
# --- Step 2: Create Color Scale (pal_cases) ---
# This must happen AFTER 'Cases' column is created (Step 1).
pal_cases <- colorNumeric(
palette = "YlOrRd",
domain = dengue_data$Cases
)
# --- Step 3: Scale circle radius smoothly (Radius column) ---
# This must happen AFTER 'Cases' column is created (Step 1).
dengue_data <- dengue_data %>%
mutate(
Radius = 5 + (log(Cases + 1) * 3) # Minimum size 5, grows with log(cases)
)
# ================================================================
# --- Create the leaflet map (Using OpenStreetMap.Mapnik theme) ---
# ================================================================
map <- leaflet(dengue_data) %>%
# Use 'OpenStreetMap.Mapnik' for a detailed, light theme
addProviderTiles("OpenStreetMap.Mapnik") %>%
setView(lng = 90.4, lat = 23.7, zoom = 7) %>%
# --- Add circle markers sized by number of cases ---
addCircleMarkers(
lng = ~Longitude,
lat = ~Latitude,
radius = ~Radius, # Circle size proportional to cases
color = "black",
fillColor = ~pal_cases(Cases),
fillOpacity = 0.85,
stroke = TRUE,
weight = 1,
popup = ~paste0(
"<div style='font-size:14px; line-height:1.5'>",
"<b style='color:#B22222;'>District:</b> ", District, "<br>",
"<b style='color:#007BFF;'>Division:</b> ", Division, "<br>",
"<b style='color:#D2691E;'>Cases:</b> ", format(Cases, big.mark=","), "<br>",
"<b style='color:#8B0000;'>Deaths:</b> ", Deaths, "<br>",
"<b style='color:#228B22;'>Remarks:</b> ", Remarks, "<br>",
"<b>Coordinates:</b> ", round(Latitude, 3), ", ", round(Longitude, 3),
"</div>"
),
label = ~paste0(District, ": ", format(Cases, big.mark=","), " cases")
) %>%
# --- Add heatmap for visual intensity ---
addHeatmap(
lng = ~Longitude,
lat = ~Latitude,
intensity = ~Cases,
blur = 25,
max = 0.05,
radius = 20,
gradient = colorRampPalette(c("blue", "cyan", "pink", "yellow", "red"))(10),
group = "Heatmap"
) %>%
# --- Add legend ---
addLegend(
position = "bottomright",
pal = pal_cases,
values = ~Cases,
title = "🦟 Dengue Cases (2025)",
opacity = 1
) %>%
# --- Add optional controls ---
addMiniMap(toggleDisplay = TRUE) %>%
addScaleBar(position = "bottomleft") %>%
addMeasure(primaryLengthUnit = "kilometers", position = "topleft")
## Warning in validateCoords(lng, lat, funcName): Data contains 13 rows with
## either missing or invalid lat/lon values and will be ignored
## Warning in validateCoords(lng, lat, funcName): Data contains 13 rows with
## either missing or invalid lat/lon values and will be ignored
# --- Display map ---
map
library(readr)
library(dplyr)
library(leaflet)
dengue_data <- read_csv("C:/Users/ashik/Desktop/dengue_cases_2025_Bangladesh.csv")
## Rows: 10 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Division / City
## dbl (3): New Cases (Last 24h), Total Cases (2025), Deaths (2025)
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
dengue_data <- dengue_data %>%
mutate(
lat = c(23.8103, 24.0000, 22.3569, 22.8456, 24.3745, 24.8949, 22.7010, 24.7136, 25.7439, 23.6850),
lon = c(90.4125, 90.5000, 91.7832, 89.5403, 88.6042, 91.8687, 90.3535, 90.3563, 89.2752, 90.3563)
)
leaflet(dengue_data) %>%
addTiles() %>%
addCircleMarkers(
~lon, ~lat,
radius = ~sqrt(`Total Cases (2025)`)/10, # FIXED
color = "red",
fillOpacity = 0.6,
popup = ~paste0(
"<b>", `Division / City`, "</b><br>",
"Total Cases: ", `Total Cases (2025)`, "<br>",
"Deaths: ", `Deaths (2025)`
)
)
Last year total cases
# --- Load libraries ---
library(leaflet)
library(leaflet.extras)
library(dplyr)
library(readr)
library(RColorBrewer)
library(htmltools)
# --- Load the dengue dataset (ensure the path is correct) ---
dengue_data <- read_csv("C:/Users/ashik/Downloads/Dengue_Cases_Bangladesh_Apr-Sept2025_with_coords.csv")
## Rows: 42 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): District/City, Division, Remarks
## dbl (4): Cases (Apr–Sept 2025), Deaths, Latitude, Longitude
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# ================================================================
# --- CONSOLIDATED DATA CLEANING, PREPARATION, AND SCALING ---
# ================================================================
# --- Step 1: Clean and prepare base data columns ---
# *** MANUALLY RE-TYPE THIS MUTATE BLOCK ***
dengue_data <- dengue_data %>%
mutate(
Cases = `Cases (Apr–Sept 2025)`, # MANUALLY RE-TYPE THIS LINE
District = `District/City`, # MANUALLY RE-TYPE THIS LINE
Deaths = Deaths,
Division = Division,
Remarks = Remarks
)
# --- Step 2: Create Color Scale (pal_cases) ---
pal_cases <- colorNumeric(
palette = "YlOrRd",
domain = dengue_data$Cases
)
# --- Step 3: Scale circle radius smoothly (Radius column) ---
dengue_data <- dengue_data %>%
mutate(
Radius = 5 + (log(Cases + 1) * 3)
)
# ================================================================
# --- Create the leaflet map (Using OpenStreetMap.Mapnik theme) ---
# ================================================================
map <- leaflet(dengue_data) %>%
addProviderTiles("OpenStreetMap.Mapnik") %>%
setView(lng = 90.4, lat = 23.7, zoom = 7) %>%
# --- Add circle markers sized by number of cases ---
addCircleMarkers(
lng = ~Longitude,
lat = ~Latitude,
radius = ~Radius,
color = "black",
fillColor = ~pal_cases(Cases),
fillOpacity = 0.85,
stroke = TRUE,
weight = 1,
popup = ~paste0(
"<div style='font-size:14px; line-height:1.5'>",
"<b style='color:#B22222;'>District:</b> ", District, "<br>",
"<b style='color:#007BFF;'>Division:</b> ", Division, "<br>",
"<b style='color:#D2691E;'>Cases:</b> ", format(Cases, big.mark=","), "<br>",
"<b style='color:#8B0000;'>Deaths:</b> ", Deaths, "<br>",
"<b style='color:#228B22;'>Remarks:</b> ", Remarks, "<br>",
"<b>Coordinates:</b> ", round(Latitude, 3), ", ", round(Longitude, 3),
"</div>"
),
label = ~paste0(District, ": ", format(Cases, big.mark=","), " cases")
) %>%
# --- Add heatmap for visual intensity ---
addHeatmap(
lng = ~Longitude,
lat = ~Latitude,
intensity = ~Cases,
blur = 25,
max = 0.05,
radius = 20,
gradient = colorRampPalette(c("blue", "cyan", "purple", "yellow", "red"))(10),
group = "Heatmap"
) %>%
# --- Add legend ---
addLegend(
position = "bottomright",
pal = pal_cases,
values = ~Cases,
title = "🦟 Dengue Cases (2025)",
opacity = 1
) %>%
# --- Add optional controls ---
addMiniMap(toggleDisplay = TRUE) %>%
addScaleBar(position = "bottomleft") %>%
addMeasure(primaryLengthUnit = "kilometers", position = "topleft")
## Warning in validateCoords(lng, lat, funcName): Data contains 34 rows with
## either missing or invalid lat/lon values and will be ignored
## Warning in validateCoords(lng, lat, funcName): Data contains 34 rows with
## either missing or invalid lat/lon values and will be ignored
# --- Display map ---
map