October 8, 2024
addMarkers()
call and label the marker05:00
Download the data from UCDP and load.
ged_yemen <- ged_data |>
filter(
country_id == 678, #gw country code
year == 2021,
date_start < "2021-03-01",
where_prec < 3, # keep if certain where event occurred
event_clarity == 1, # keep if event reporting is clear
) |>
mutate(deaths = deaths_a + deaths_b + deaths_civilians + deaths_unknown) |>
select(event_id = id,
country_id,
date = date_start,
gov_deaths = deaths_a,
rebel_deaths = deaths_b,
civilian_deaths = deaths_civilians,
deaths,
place = where_coordinates,
latitude,
longitude) |>
sf::st_as_sf(coords = c("longitude", "latitude"))
# save icon
icon <- awesomeIcons(
icon = "ios-close",
iconColor = "black",
markerColor = "red",
library = "ion"
)
# Build map
leaflet(data = ged_yemen) |>
addTiles() |>
setView(lng = 44.1910, lat = 15.3694, zoom = 6) |> # Sana'a coordinates
addAwesomeMarkers(
icon = icon,
popup = ~as.character(deaths),
label = ~place
)