【R】igoR

1. はじめに

igoRは、Intergovernmental Organizations (v3)からデータを取得できるパッケージです。

2. インストール

CRANからインストールできます。

install.packages("igoR")

3. つかってみる

library(igoR)
library(ggplot2)
library(tidyverse)

igos_by_year <- igo_year_format3 %>% group_by(year) %>%
  summarise(value = n(), .groups = "keep") %>%
  mutate(variable = "Total IGOs")

countries_by_year <- state_year_format3 %>% group_by(year) %>%
  summarise(value = n(), .groups = "keep") %>%
  mutate(variable = "Number of COW states")

all_by_year <- rbind(igos_by_year, countries_by_year) %>%
  mutate(variable = factor(variable))

ggplot(all_by_year, aes(x = year, y = value)) +
  geom_line(size = 1, color = "red", aes(linetype = variable)) +
  scale_linetype_manual(values = c("solid", "dashed")) +
  ylim(0, 400)

asia_cntries <- c("Japan", "China", "India",
                   "Korea", "Indonesia",
                   "Bangladesh")

asia_igos <- igo_state_membership(
  state = asia_cntries,
  year = 1900:2015,
  status = c("Full Membership")
)

asia <- asia_igos %>%
  group_by(statenme, year) %>%
  summarise(values = n(), .groups = "keep")

asia$statenme <- factor(asia$statenme,
                         levels = asia_cntries)



ggplot(asia, aes(x = year, y = values)) +
  geom_line(size = 0.8, color = "black", aes(linetype = statenme)) +
  scale_linetype_manual(values = c("solid", "dashed",
                                   "dotted", "dotdash",
                                   "longdash", "solid")) +
  guides(linetype = guide_legend(ncol = 3, byrow = TRUE)) +
  theme(axis.title.y.left = element_text(
    family = "sans",
    size = 12,
    margin =  margin(r = 6)
  )) +
  scale_y_continuous(
    "Number of memberships",
    breaks = c(0, 20, 40, 60, 80, 100),
    limits = c(0, 95),
    labels = as.character(c(0, 20, 40, 60, 80, 100))
  ) 

4. さいごに

このメンバーシップが確固たるものになったのは、20世紀後半なんですね。

Add a Comment

メールアドレスが公開されることはありません。