Gross capital formation (% of GDP)

Data - WDI

Nobs - Javascript

Code
NE.GDI.TOTL.ZS %>%
  left_join(iso2c, by = "iso2c") %>%
  group_by(iso2c, Iso2c) %>%
  mutate(value = round(value, 2)) %>%
  summarise(Nobs = n(),
            `Year 1` = first(year),
            `Investment 1 (%)` = first(value),
            `Year 2` = last(year),
            `Investment 2 (%)` = last(value)) %>%
  arrange(-Nobs) %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(Iso2c)),
         Flag = paste0('<img src="../../bib/flags/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

France, Germany, Italy

Code
NE.GDI.TOTL.ZS %>%
  filter(iso2c %in% c("IT", "FR", "DE")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(value = value/100) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_3flags +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Gross capital formation (% of GDP)")

Japan, Switzerland

Code
NE.GDI.TOTL.ZS %>%
  filter(iso2c %in% c("JP", "CH")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(value = value/100) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_2flags +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Gross capital formation (% of GDP)")

China, United States, France, GErmany

English

Code
NE.GDI.TOTL.ZS %>%
  filter(iso2c %in% c("CN", "US", "FR", "DE")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(color = ifelse(iso2c == "US", color2, color)) %>%
  mutate(value = value/100) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_4flags +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 5),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Gross capital formation (% of GDP)")

French

Code
NE.GDI.TOTL.ZS %>%
  filter(iso2c %in% c("CN", "US", "FR", "DE")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(color = ifelse(iso2c == "US", color2, color)) %>%
  mutate(value = value/100) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_4flags +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 5),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Formation brute de capital fixe (% du PIB)")

China, France, Germany

Code
NE.GDI.TOTL.ZS %>%
  filter(iso2c %in% c("CN", "FR", "DE")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(value = value/100) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_3flags +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Gross capital formation (% of GDP)")

Spain, United Kingdom, United States

Code
NE.GDI.TOTL.ZS %>%
  filter(iso2c %in% c("US", "GB", "ES")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(value = value/100) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_3flags +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Gross capital formation (% of GDP)")

Argentina, Chile, Venezuela

Code
NE.GDI.TOTL.ZS %>%
  filter(iso2c %in% c("AR", "CL", "VE")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(value = value/100) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_3flags +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Gross capital formation (% of GDP)")

Greece, Hong Kong, Mexico

Code
NE.GDI.TOTL.ZS %>%
  filter(iso2c %in% c("GR", "HK", "MX")) %>%
  left_join(iso2c, by = "iso2c") %>%
  year_to_date %>%
  left_join(colors, by = c("Iso2c" = "country")) %>%
  mutate(value = value/100) %>%
  ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_3flags +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Gross capital formation (% of GDP)")