I would like to merge some polygons together
- Morocco with Western Sahara
- Sudan with South Sudan
map_data('world')
I would like to merge some polygons together
map_data('world')
library(ggplot2)
library(dplyr)
world_map <- map_data("world")
merged_map <- world_map |>
mutate(region = case_when(
region %in% c("Morocco", "Western Sahara") ~ "Morocco",
region %in% c("Sudan", "South Sudan") ~ "Sudan",
TRUE ~ region
))
ggplot(merged_map, aes(x = long, y = lat, group = group, fill = region)) +
geom_polygon(color = "black") +
coord_fixed() +
theme_minimal()
excuse me.I have a problem.I want to create a world map showing the incidence rates in different regions. However, my data only includes region names and numerical values. It seems like I also need the longitude and latitude of each region to generate the map. Is that true? How can I obtain the longitude and latitude for so many regions?