Quarterly National Accounts, GDP Per Capita

Data - OECD

Info

source dataset .html .RData
oecd QNA_EXPENDITURE_CAPITA 2024-11-22 2024-11-22

Last

obsTime

obsTime Nobs
2024-Q3 8

obsValue

REF_AREA PRICE_BASE obsTime obsValue
DEU LR 2024-Q3 50437.6
SVN LR 2024-Q3 39361.3
USA V 2024-Q3 87044.2
CRI LR 2024-Q3 21693.3
JPN LR 2024-Q3 43600.4
ESP LR 2024-Q3 39700.8
CHL LR 2024-Q3 23838.8
USA LR 2024-Q3 67495.9

FREQ

Code
QNA_EXPENDITURE_CAPITA %>%
  left_join(FREQ, by = "FREQ") %>%
  group_by(FREQ, Freq) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  print_table_conditional()
FREQ Freq Nobs
Q Quarterly 11690
A Annual 3031

REF_AREA

Code
QNA_EXPENDITURE_CAPITA %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  group_by(REF_AREA, Ref_area) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  print_table_conditional()

TRANSACTION

Code
QNA_EXPENDITURE_CAPITA %>%
  left_join(TRANSACTION, by = "TRANSACTION") %>%
  group_by(TRANSACTION, Transaction) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  print_table_conditional()
TRANSACTION Transaction Nobs
B1GQ_POP Gross domestic product, per capita 14721

PRICE_BASE

Code
QNA_EXPENDITURE_CAPITA %>%
  left_join(PRICE_BASE, by = "PRICE_BASE") %>%
  group_by(PRICE_BASE, Price_base) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  print_table_conditional()
PRICE_BASE Price_base Nobs
LR Volumes chaînés (rebasés) 7361
V Prix courants 7360

U.S., Europe

Tous

Code
metadata_load_fr("REF_AREA", "CL_AREA")
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  quarter_to_date %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Zone euro", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  #mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (1995T1 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = Ref_area)) + 
  # #003399, #3C3B6E
  scale_color_manual(values = c("#B22234", "#003399")) +
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1999-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf), 
            fill = '#B22234', alpha = 0.1)  +
  geom_rect(data = cepr_recessions %>%
              filter(Peak > as.Date("1999-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf), 
            fill = '#003399', alpha = 0.1)  +
  scale_x_date(breaks = c(seq(1940, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = c(0.26, 0.8),
        legend.title = element_blank()) +
  scale_y_log10(breaks = seq(100, 1000, 20))

1995-

Code
metadata_load_fr("REF_AREA", "CL_AREA")
plot <- QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  quarter_to_date %>%
  filter(date >= as.Date("1995-01-01")) %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Zone euro", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  #mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (1995T1 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = Ref_area)) + 
  # #003399, #3C3B6E
  scale_color_manual(values = c("#B22234", "#003399")) +
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1999-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf), 
            fill = '#B22234', alpha = 0.1)  +
  geom_rect(data = cepr_recessions %>%
              filter(Peak > as.Date("1999-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf), 
            fill = '#003399', alpha = 0.1)  +
  scale_x_date(breaks = c(seq(1994, 2100, 5), seq(1997, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = c(0.26, 0.8),
        legend.title = element_blank()) +
  scale_y_log10(breaks = seq(50, 200, 5))

plot

Code
save(plot, file = "QNA_EXPENDITURE_CAPITA_files/figure-html/USA-EA20-1995-1.RData")

1999-

Flags

Code
metadata_load("REF_AREA", "CL_AREA")
plot <- QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  quarter_to_date %>%
  filter(date >= as.Date("1999-01-01")) %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  #mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("GDP per capita") +
  geom_line(aes(x = date, y = obsValue, color = Ref_area)) + 
  # #003399, #3C3B6E
  scale_color_manual(values = c("#003399", "#B22234")) + add_2flags +
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1999-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf), 
            fill = '#B22234', alpha = 0.1)  +
  geom_rect(data = cepr_recessions %>%
              filter(Peak > as.Date("1999-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf), 
            fill = '#003399', alpha = 0.1)  +
  scale_x_date(breaks = c(seq(1999, 2100, 5), seq(1997, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = c(0.26, 0.8),
        legend.title = element_blank()) +
  scale_y_log10(breaks = seq(50, 200, 5))

plot

No flags

Code
metadata_load_fr("REF_AREA", "CL_AREA")
plot <- QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  quarter_to_date %>%
  filter(date >= as.Date("1999-01-01")) %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Zone euro", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  ungroup %>%
  add_row(obsValue = 127.9913, date = as.Date("2024-04-01"), Ref_area = "Zone euro") %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  #mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("") +
  geom_line(aes(x = date, y = obsValue, color = Ref_area)) + 
  # #003399, #3C3B6E
  scale_color_manual(values = c("#B22234", "#003399")) +
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1999-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf), 
            fill = '#B22234', alpha = 0.1)  +
  geom_rect(data = cepr_recessions %>%
              filter(Peak > as.Date("1999-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf), 
            fill = '#003399', alpha = 0.1)  +
  scale_x_date(breaks = c(seq(1999, 2100, 5), seq(1997, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = c(0.26, 0.8),
        legend.title = element_blank()) +
  scale_y_log10(breaks = seq(50, 200, 5)) +
  labs(caption = "")

plot

Code
save(plot, file = "QNA_EXPENDITURE_CAPITA_files/figure-html/USA-EA20-1999-1.RData")

2000-

Code
metadata_load_fr("REF_AREA", "CL_AREA")
plot <- QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  quarter_to_date %>%
  filter(date >= as.Date("2000-01-01")) %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Zone euro", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (2000T1 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = Ref_area)) + 
  # #003399, #3C3B6E
  scale_color_manual(values = c("#B22234", "#003399")) +
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1999-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf),
            fill = '#B22234', alpha = 0.1)  +
  geom_rect(data = cepr_recessions %>%
              filter(Peak > as.Date("1999-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf), 
            fill = '#003399', alpha = 0.1)  +
  scale_x_date(breaks = c(seq(2000, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = c(0.26, 0.8),
        legend.title = element_blank()) +
  scale_y_log10(breaks = seq(50, 200, 5))

save(plot, file = "QNA_EXPENDITURE_CAPITA_files/figure-html/USA-EA20-2000-1.RData")
plot

U.S., Europe, France, Germany

Tous

Code
metadata_load("REF_AREA", "CL_AREA")
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20", "FRA", "DEU"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (1995 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_4flags +
  scale_color_identity() +
  scale_x_date(breaks = seq(1900, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(100, 1000, 20))

1995-

Code
metadata_load("REF_AREA", "CL_AREA")
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20", "FRA", "DEU"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  filter(date >= as.Date("1995-01-01")) %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (1995 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_4flags +
  scale_color_identity() +
  scale_x_date(breaks = seq(1960, 2100, 2) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(50, 200, 5))

U.S., Europe, France, Italy

Tous

Code
metadata_load("REF_AREA", "CL_AREA")
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20", "FRA", "ITA"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_4flags +
  scale_color_identity() +
  scale_x_date(breaks = seq(1900, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(100, 1000, 20))

1995-

Code
metadata_load("REF_AREA", "CL_AREA")
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20", "FRA", "ITA"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  filter(date >= as.Date("1995-01-01")) %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (1995 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_4flags +
  scale_color_identity() +
  scale_x_date(breaks = seq(1960, 2100, 2) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(50, 200, 5))

1999-

Code
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20", "FRA", "ITA"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  filter(date >= as.Date("1999-01-01")) %>%
  rename(Ref_area = Ref_area) %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (1999 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_4flags +
  scale_color_identity() +
  scale_x_date(breaks = c(seq(1999, 2100, 5), seq(1997, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(50, 200, 5))

2000-

Code
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20", "FRA", "ITA"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  filter(date >= as.Date("2000-01-01")) %>%
  rename(Ref_area = Ref_area) %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (2000 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_4flags +
  scale_color_identity() +
  scale_x_date(breaks = seq(1960, 2100, 2) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(50, 200, 5))

Avril 2017-

Code
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20", "FRA", "ITA"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  filter(date >= as.Date("2017-04-01")) %>%
  rename(Ref_area = Ref_area) %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (Avril 2017 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_4flags +
  scale_color_identity() +
  scale_x_date(breaks = seq(1960, 2100, 1) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(50, 200, 5))

Oher graphs

1999-

Code
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20", "ITA"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  filter(date >= as.Date("1999-01-01")) %>%
  rename(Ref_area = Ref_area) %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (1999 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_3flags +
  scale_color_identity() +
  scale_x_date(breaks = c(seq(1999, 2100, 5), seq(1997, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(50, 200, 5))

1999-

french

Code
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  filter(date >= as.Date("2000-01-01")) %>%
  rename(Ref_area = Ref_area) %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("PIB par habitant (2000 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_2flags +
  scale_color_identity() +
  scale_x_date(breaks = c(seq(2000, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(50, 200, 5))

english

Code
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  filter(date >= as.Date("2000-01-01")) %>%
  rename(Ref_area = Ref_area) %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[1]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("GDP per capita (2000 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_2flags +
  scale_color_identity() +
  scale_x_date(breaks = c(seq(2000, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(50, 200, 5))

US, Europe, Greece

2000-

Code
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20", "GRC", "ESP"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  filter(date >= as.Date("2000-01-01")) %>%
  rename(Ref_area = Ref_area) %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area),
         Ref_area = ifelse(REF_AREA == "OECD", "OECD members", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[date == as.Date("2008-01-01")]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  mutate(color = ifelse(REF_AREA == "ESP", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("GDP per capita (2000 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_4flags +
  scale_color_identity() +
  scale_x_date(breaks = c(seq(2000, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(50, 200, 5))

US, Europe, OECD

2000-

Code
QNA_EXPENDITURE_CAPITA %>%
  filter(REF_AREA %in% c("USA", "EA20", "OECD"),
         FREQ == "Q",
         PRICE_BASE == "LR") %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  quarter_to_date %>%
  filter(date >= as.Date("2000-01-01")) %>%
  rename(Ref_area = Ref_area) %>%
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area),
         Ref_area = ifelse(REF_AREA == "OECD", "OECD members", Ref_area)) %>%
  group_by(Ref_area) %>%
  arrange(date) %>%
  mutate(obsValue = 100 * obsValue / obsValue[date == as.Date("2008-01-01")]) %>%
  left_join(colors, by = c("Ref_area" = "country")) %>%
  mutate(color = ifelse(REF_AREA == "EA20", color2, color)) %>%
  ggplot(.) + theme_minimal() + xlab("") + ylab("GDP per capita (2000 = 100)") +
  geom_line(aes(x = date, y = obsValue, color = color)) + add_3flags +
  scale_color_identity() +
  scale_x_date(breaks = c(seq(2000, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = "none") +
  scale_y_log10(breaks = seq(50, 200, 5))