GDP growth (annual %)

Data - WDI

Info

LAST_DOWNLOAD

Code
tibble(dataset = c("NY.GDP.MKTP.KD.ZG", "NY.GDP.MKTP.CD")) %>%
  mutate(LAST_DOWNLOAD = as.Date(file.info(paste0("~/Library/Mobile\ Documents/com~apple~CloudDocs/website/data/wdi/", dataset, ".RData"))$mtime)) %>%
  mutate(html = paste0("[html](https://fgeerolf.com/data/wdi/", dataset, '.html)')) %>%
  print_table_conditional()
dataset LAST_DOWNLOAD html
NY.GDP.MKTP.KD.ZG 2024-04-14 [html]
NY.GDP.MKTP.CD 2024-05-06 [html]

LAST_COMPILE

LAST_COMPILE
2024-06-20

Last

Code
NY.GDP.MKTP.KD.ZG %>%
  group_by(year) %>%
  summarise(Nobs = n()) %>%
  arrange(desc(year)) %>%
  head(1) %>%
  print_table_conditional()
year Nobs
2022 243

Nobs - Javascript

Code
NY.GDP.MKTP.KD.ZG %>%
  left_join(iso2c, by = "iso2c") %>%
  group_by(iso2c, Iso2c) %>%
  rename(value = `NY.GDP.MKTP.KD.ZG`) %>%
  mutate(value = round(value, 2)) %>%
  summarise(Nobs = n(),
            `Year 1` = first(year),
            `GDP Growth 1` = first(value) %>% paste0(" %"),
            `Year 2` = last(year),
            `GDP Growth 2` = last(value) %>% paste0(" %")) %>%
  arrange(-Nobs) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Periods of Low GDP Growth

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(`NY.GDP.MKTP.KD.ZG` < 0) %>%
  arrange(`NY.GDP.MKTP.KD.ZG`) %>%
  mutate(`NY.GDP.MKTP.KD.ZG` = round(`NY.GDP.MKTP.KD.ZG`, 2)) %>%
  left_join(iso2c, by = "iso2c") %>%
  select(iso2c, Iso2c, year, `NY.GDP.MKTP.KD.ZG`) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Argentina

1996-2005

Code
NY.GDP.MKTP.KD.ZG %>%
  year_to_date() %>%
  filter(iso2c == "AR",
         date >= as.Date("1996-01-01"),
         date <= as.Date("2005-01-01")) %>%
  ggplot(.) + geom_line() + theme_minimal() + 
  aes(x = date, y = NY.GDP.MKTP.KD.ZG/100) + xlab("") + ylab("GDP Growth") +
  scale_x_date(breaks = seq(1900, 2025, 1) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 5),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

1996-2020

Code
NY.GDP.MKTP.KD.ZG %>%
  year_to_date() %>%
  filter(iso2c == "AR",
         date >= as.Date("1996-01-01"),
         date <= as.Date("2020-01-01")) %>%
  ggplot(.) + geom_line() + theme_minimal() + 
  aes(x = date, y = NY.GDP.MKTP.KD.ZG/100) + xlab("") + ylab("GDP Growth") +
  scale_x_date(breaks = seq(1900, 2025, 1) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 5),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

China

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c == "CN") %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  ggplot(.) + geom_line() + theme_minimal() + 
  aes(x = date, y = NY.GDP.MKTP.KD.ZG/100) + 
  xlab("") + ylab("GDP Growth") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 5),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

Chile

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c == "CL") %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  ggplot(.) + geom_line() + theme_minimal() + 
  aes(x = date, y = NY.GDP.MKTP.KD.ZG/100) + 
  xlab("") + ylab("GDP Growth") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 5),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

Brazil

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c == "BR") %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  ggplot(.) + geom_line() + theme_minimal() + 
  aes(x = date, y = NY.GDP.MKTP.KD.ZG/100) + 
  xlab("") + ylab("GDP Growth") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 5),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

Russia

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c == "RU") %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  ggplot(.) + geom_line() + theme_minimal() + 
  aes(x = date, y = NY.GDP.MKTP.KD.ZG/100) + 
  xlab("") + ylab("GDP Growth") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 2),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

South Korea

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c == "KR") %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  ggplot(.) + geom_line() + theme_minimal() + 
  aes(x = date, y = NY.GDP.MKTP.KD.ZG/100) + 
  xlab("") + ylab("GDP Growth") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 2),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

France, Italy, Germany

All

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c %in% c("FR", "DE", "IT")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  mutate(value = NY.GDP.MKTP.KD.ZG/100) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + xlab("") + ylab("GDP Growth") +
  scale_color_identity() + add_3flags +
  theme(legend.title = element_blank(),
        legend.position = c(0.6, 0.9),
        legend.direction = "horizontal") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 2),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

1995-

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c %in% c("FR", "DE", "IT")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  filter(date >= as.Date("1995-01-01")) %>%
  mutate(value = NY.GDP.MKTP.KD.ZG/100) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + xlab("") + ylab("GDP Growth") +
  scale_color_identity() + add_3flags +
  theme(legend.title = element_blank(),
        legend.position = c(0.6, 0.9),
        legend.direction = "horizontal") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 2),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

Spain, Netherlands, Portugal

All

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c %in% c("ES", "NL", "PT")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  mutate(value = NY.GDP.MKTP.KD.ZG/100) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + xlab("") + ylab("GDP Growth") +
  scale_color_identity() + add_3flags +
  theme(legend.title = element_blank(),
        legend.position = c(0.6, 0.9),
        legend.direction = "horizontal") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 2),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

1995-

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c %in% c("ES", "NL", "PT")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  filter(date >= as.Date("1995-01-01")) %>%
  mutate(value = NY.GDP.MKTP.KD.ZG/100) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + xlab("") + ylab("GDP Growth") +
  scale_color_identity() + add_3flags +
  theme(legend.title = element_blank(),
        legend.position = c(0.6, 0.9),
        legend.direction = "horizontal") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 2),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

Japan, United States, United Kingdom

All

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c %in% c("JP", "GB", "US")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  mutate(value = NY.GDP.MKTP.KD.ZG/100) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + xlab("") + ylab("GDP Growth") +
  scale_color_identity() + add_3flags +
  theme(legend.title = element_blank(),
        legend.position = c(0.6, 0.9),
        legend.direction = "horizontal") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 2),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")

1995-

Code
NY.GDP.MKTP.KD.ZG %>%
  filter(iso2c %in% c("JP", "GB", "US")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date() %>%
  filter(date >= as.Date("1995-01-01")) %>%
  mutate(value = NY.GDP.MKTP.KD.ZG/100) %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + xlab("") + ylab("GDP Growth") +
  scale_color_identity() + add_3flags +
  theme(legend.title = element_blank(),
        legend.position = c(0.6, 0.9),
        legend.direction = "horizontal") +
  scale_x_date(breaks = seq(1900, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 10000, 2),
                     labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed", color = "grey")