The East African Community (EAC) is a regional intergovernmental organization comprising eight countries in East Africa. The EAC promotes economic integration, trade, and political cooperation among its member states. The member countries include:
- Tanzania
- Kenya
- Uganda
- Rwanda
- Burundi
- South Sudan
- Democratic Republic of Congo (DRC)
- Somalia (newest member)
The EAC aims to establish a common market, a monetary union, and eventually a political federation to enhance regional stability and development.
The following R script uses the rgeoboundaries
package to fetch and visualize the geographic boundaries of the EAC member states. The ggplot2
library is used to create a colorful map of the region.
library(rgeoboundaries)
library(ggplot2)
library(dplyr)
library(sf)
# List of EAC countries including Somalia
countries <- c("Tanzania", "Kenya", "Uganda", "Rwanda", "Burundi", "South Sudan",
"Democratic Republic of Congo", "Somalia")
# Fetch boundaries for each country and add a column with the country name
EAC_boundaries <- bind_rows(lapply(countries, function(cntry) {
boundary <- geoboundaries(cntry)
boundary$country <- cntry # Add country name column
return(boundary)
}))
# Plot using ggplot2 with different colors for each country
ggplot(data = EAC_boundaries) +
geom_sf(aes(fill = country), color = "black") + # Assign unique colors
scale_fill_manual(values = c("Tanzania" = "#1f78b4", "Kenya" = "#33a02c", "Uganda" = "#e31a1c",
"Rwanda" = "#ff7f00", "Burundi" = "#6a3d9a", "South Sudan" = "#b15928",
"Democratic Republic of Congo" = "#a6cee3", "Somalia" = "#b2df8a")) +
xlab("Longitude") +
ylab("Latitude") +
ggtitle("East Africa Community (Colorful Map)") +
theme_minimal() +
theme(legend.title = element_blank()) # Remove legend title
- Load Required Packages: The script loads
rgeoboundaries
,ggplot2
,dplyr
, andsf
for spatial data processing and visualization. - Define EAC Member States: A list of EAC countries (including Somalia) is created.
- Fetch Country Boundaries: The
geoboundaries()
function is used to retrieve the geographic boundaries of each country. - Merge Boundaries: The
bind_rows()
function combines all country boundary datasets into one. - Create the Map: The
ggplot2
package is used to generate a map where each country is filled with a different color. - Improve Visualization: A manual color scale is applied, and the theme is set to minimal for better aesthetics.
This script provides a simple way to visualize the geographical boundaries of the East African Community (EAC) in R. The colorful representation helps distinguish each country, making it useful for presentations, research, and policy analysis.