The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Maps are a powerful tool to show data. As the scope of igoR are the Intergovernmental Organizations, mapping and IGOs are a perfect match.
This vignette provides some geospatial visualizations using the IGO data sets (Pevehouse et al. 2020) included in this package. Specific packages used for geospatial data:
Also countrycode is a very handy package for translating between coding schemes (CoW, ISO3, NUTS, FIPS) and country names.
library(igoR)
# Helper packages
library(dplyr)
library(ggplot2)
library(countrycode)
# Geospatial packages
library(giscoR)
library(sf)
The following maps shows the evolution of countries that are members of the United Nations. First we should extract the data:
# Extract shapes
world <- gisco_get_countries()
# Extract three dates - some errors given that ISO doesnt have every COW Code
un_all <- igo_members("UN", c(1950, 1980, 2010), status = "Full Membership") %>%
# Add ISO3 Code
mutate(ISO3_CODE = countrycode(ccode, "cown", "iso3c", warn = FALSE)) %>%
select(year, orgname, ISO3_CODE, category)
# Auxiliar data.frame to collect every ISO3-year pairs
base_df <- expand.grid(
ISO3_CODE = unique(world$ISO3_CODE),
year = unique(un_all$year),
stringsAsFactors = FALSE
) %>%
as_tibble()
# Merge everything with the spatial object
un_all_sf <- world %>%
# Expand to all cases
left_join(base_df, by = "ISO3_CODE") %>%
# Add info
left_join(un_all, by = c("ISO3_CODE", "year"))
Note that the map is not completely accurate, as the base shapefile contains the countries that exists on 2016. Some countries, as Czechoslovakia, East or West Germany are not included.
Now we are ready to plot with ggplot2:
ggplot(un_all_sf) +
geom_sf(aes(fill = category), color = NA, show.legend = FALSE) +
# Robinson
coord_sf(crs = "ESRI:54030") +
facet_wrap(~year, ncol = 1, strip.position = "left") +
scale_fill_manual(
values = c("Full Membership" = "#74A9CF"),
na.value = "#E0E0E0",
) +
labs(
title = "UN Members", caption = gisco_attributions(),
) +
theme_minimal() +
theme(plot.caption = element_text(face = "italic", hjust = 0.15))
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.