~/data/wdi/

Info

LAST_DOWNLOAD

source dataset Title Download Compile
wdi GC.XPN.INTP.CN Interest payments (current LCU) 2023-03-30 2023-04-30
eurostat ei_mfir_m Interest rates - monthly data 2023-06-05 2023-06-05
eurostat gov_10q_ggdebt Quarterly government debt 2023-06-03 2023-06-01
fred r Interest Rates 2023-06-05 2023-06-05
gfd debt Debt 2021-03-01 2021-08-22
imf FM Fiscal Monitor 2020-03-13 2023-03-29
imf GGXCNL_G01_GDP_PT Net lending/borrowing (also referred as overall balance) (% of GDP) 2023-06-03 2023-06-01
imf GGXONLB_G01_GDP_PT Primary net lending/borrowing (also referred as primary balance) (% of GDP) 2023-06-03 2023-06-03
imf GGXWDN_G01_GDP_PT Net debt (% of GDP) 2021-04-01 2023-04-01
imf HPDD Historical Public Debt Database NA 2023-03-24
wdi GC.DOD.TOTL.GD.ZS Central government debt, total (% of GDP) 2023-03-29 2023-06-18
wdi GC.XPN.INTP.RV.ZS Interest payments (% of revenue) 2020-05-09 2023-03-30
wdi GC.XPN.INTP.ZS Interest payments (% of expense) 2020-05-09 2023-03-30

LAST_COMPILE

LAST_COMPILE
2023-06-18

Last

GC.XPN.INTP.CN %>%
  group_by(year) %>%
  summarise(Nobs = n()) %>%
  arrange(desc(year)) %>%
  head(1) %>%
  print_table_conditional()
year Nobs
2021 266

Nobs - Javascript

GC.XPN.INTP.CN %>%
  left_join(NY.GDP.MKTP.CN, by = c("iso2c", "year")) %>%
  left_join(iso2c, by = "iso2c") %>%
  mutate(value = `GC.XPN.INTP.CN`/`NY.GDP.MKTP.CN`,
         value = round(100*value, 2)) %>%
  group_by(iso2c, Iso2c) %>%
  summarise(Nobs = n(),
            `Year 1` = first(year),
            `Interest 1` = first(value),
            `Year 2` = last(year),
            `Interest 2` = last(value)) %>%
  arrange(-Nobs) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Ex: Interest Payments

GC.XPN.INTP.CN %>%
  left_join(NY.GDP.MKTP.CN, by = c("iso2c", "year")) %>%
  filter(year == 2017) %>%
  left_join(iso2c, by = "iso2c") %>%
  mutate(interest_payments = round(100*`GC.XPN.INTP.CN`/`NY.GDP.MKTP.CN`, 2)) %>%
  arrange(-interest_payments) %>%
  mutate(interest_payments = interest_payments %>% round(digits = 2) %>% paste0(" %")) %>%
  select(iso2c, Iso2c, interest_payments) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Argentina, Portugal, Spain

GC.XPN.INTP.CN %>%
  left_join(NY.GDP.MKTP.CN, by = c("iso2c", "year")) %>%
  mutate(value = `GC.XPN.INTP.CN`/`NY.GDP.MKTP.CN`) %>%
  filter(iso2c %in% c("PT", "IT", "ES")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  group_by(Iso2c) %>%
  complete(date = seq.Date(min(date), max(date), by = "year")) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(color = ifelse(iso2c == "PT", color2, color)) %>%
  na.omit %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + add_3flags + scale_color_identity() +
  xlab("") + ylab("Interest Payments (% of GDP)") +
  theme(legend.title = element_blank(),
        legend.position = c(0.85, 0.85)) +
  scale_x_date(breaks = seq(1900, 2020, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 1),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

Italy, Portugal, Spain

GC.XPN.INTP.CN %>%
  left_join(NY.GDP.MKTP.CN, by = c("iso2c", "year")) %>%
  mutate(value = `GC.XPN.INTP.CN`/`NY.GDP.MKTP.CN`) %>%
  filter(iso2c %in% c("PT", "IT", "ES")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  group_by(Iso2c) %>%
  complete(date = seq.Date(min(date), max(date), by = "year")) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(color = ifelse(iso2c == "PT", color2, color)) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + add_3flags + scale_color_identity() +
  xlab("") + ylab("Interest Payments (% of GDP)") +
  theme(legend.title = element_blank(),
        legend.position = c(0.85, 0.85)) +
  scale_x_date(breaks = seq(1900, 2020, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 1),
                     labels = percent_format(a = 1))

Greece, Iceland, Denmark

GC.XPN.INTP.CN %>%
  left_join(NY.GDP.MKTP.CN, by = c("iso2c", "year")) %>%
  mutate(value = `GC.XPN.INTP.CN`/`NY.GDP.MKTP.CN`) %>%
  filter(iso2c %in% c("GR", "IS", "DK")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  #filter(date >= min(date), !is.na(GC.XPN.INTP.CN), !is.na(NY.GDP.MKTP.CN)) %>%
  group_by(Iso2c) %>%
  complete(date = seq.Date(min(date), max(date), by = "year")) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(color = ifelse(iso2c == "PT", color2, color)) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + add_3flags + scale_color_identity() +
  xlab("") + ylab("Interest Payments (% of GDP)") +
  theme(legend.title = element_blank(),
        legend.position = c(0.15, 0.85)) +
  add_3flags +
  scale_x_date(breaks = seq(1900, 2020, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 1),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

France, Italy, Germany

GC.XPN.INTP.CN %>%
  left_join(NY.GDP.MKTP.CN, by = c("iso2c", "year")) %>%
  mutate(value = `GC.XPN.INTP.CN`/`NY.GDP.MKTP.CN`) %>%
  filter(iso2c %in% c("FR", "CH", "IT")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  group_by(Iso2c) %>%
  complete(date = seq.Date(min(date), max(date), by = "year")) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(color = ifelse(iso2c == "FR", color2, color)) %>%
  na.omit %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + add_3flags + scale_color_identity() +
  xlab("") + ylab("Interest Payments (% of GDP)") +
  add_3flags +
  theme(legend.title = element_blank(),
        legend.position = c(0.85, 0.85)) +
  scale_x_date(breaks = seq(1900, 2020, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 1),
                     labels = percent_format(a = 1))

United States, United Kingdom, Japan

GC.XPN.INTP.CN %>%
  left_join(NY.GDP.MKTP.CN, by = c("iso2c", "year")) %>%
  mutate(value = `GC.XPN.INTP.CN`/`NY.GDP.MKTP.CN`) %>%
  filter(iso2c %in% c("JP", "US", "GB")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  group_by(Iso2c) %>%
  complete(date = seq.Date(min(date), max(date), by = "year")) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(color = ifelse(iso2c == "FR", color2, color)) %>%
  na.omit %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + add_3flags + scale_color_identity() +
  xlab("") + ylab("Interest Payments (% of GDP)") +
  theme(legend.title = element_blank(),
        legend.position = c(0.8, 0.2)) +
  scale_x_date(breaks = seq(1900, 2020, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 1),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

Lebanon, Brazil, Jamaica

GC.XPN.INTP.CN %>%
  left_join(NY.GDP.MKTP.CN, by = c("iso2c", "year")) %>%
  mutate(value = `GC.XPN.INTP.CN`/`NY.GDP.MKTP.CN`) %>%
  filter(iso2c %in% c("LB", "BR", "JM")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  group_by(Iso2c) %>%
  complete(date = seq.Date(min(date), max(date), by = "year")) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(color = ifelse(iso2c == "FR", color2, color)) %>%
  na.omit %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + add_3flags + scale_color_identity() +
  xlab("") + ylab("Interest Payments (% of GDP)") +
  theme(legend.title = element_blank(),
        legend.position = c(0.85, 0.85)) +
  scale_x_date(breaks = seq(1900, 2020, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 1),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")