Import data from Eurostat

codes <- search_eurostat(pattern = "EU direct investment flows, breakdown by partner country and economic activity")

codes$code
## [1] "bop_fdi_flow_r2" "bop_fdi_flows"   "bop_fdi6_flow"
postSoviet <- c("AM", "AZ", "BY", "MD", "GE", "KY", "KZ", "RU", "TJ", "TM", "UA", "UZ")

Data are available with different criteria, for different periods.

FDI flows to post-Soviet

indicator code: bop_fdi6_flow

First by country

fdi <- get_eurostat("bop_fdi6_flow", time_format = "num")
## Table bop_fdi6_flow cached at /tmp/Rtmp17DZ4q/eurostat/bop_fdi6_flow_num_code_TF.rds
## Keep only post-Soviet countries
fdiPS <- fdi[grepl(paste(postSoviet, collapse = "|"), x = fdi$partner)&nchar(as.character(fdi$partner))==2,]
## Plot the data
fdiPS %>% group_by(partner, time) %>% summarise(values = sum(values, na.rm = TRUE)) %>% ggplot(mapping = aes(x = time, y = values, color = partner)) + geom_line() + scale_x_continuous(breaks=unique(fdiPS$time), name = "") + scale_y_continuous(labels = comma, name = "") + labs(title = "EU direct investment flows, by partner country ", subtitle = "Post-Soviet only, excluding Baltic republics", caption = "Eurostat indicator: bop_fdi6_flow")

Separating by country, Russia dominates, “hiding” other results.

Same as above, but without Russia.

fdiPS %>% filter(partner!="RU") %>% group_by(partner, time) %>% summarise(values = sum(values, na.rm = TRUE)) %>% ggplot(mapping = aes(x = time, y = values, color = partner)) + geom_line() + scale_x_continuous(breaks=unique(fdiPS$time), name = "") + scale_y_continuous(labels = comma, name = "") + labs(title= "EU direct investment flows, by partner country ", subtitle = "Post-Soviet only, excluding Baltic republics and Russia", caption = "Eurostat indicator: bop_fdi6_flow")

Calculate post-Soviet average, with Russia and then without Russia

fdiPS %>% group_by(time) %>% summarise(values = sum(values, na.rm = TRUE)) %>% ggplot(mapping = aes(x = time, y = values)) + geom_line() + scale_x_continuous(breaks=unique(fdiPS$time), name = "") + scale_y_continuous(labels = comma, name = "") + labs(title= "EU direct investment flows, by partner country ", subtitle = "Post-Soviet only, excluding Baltic republics", caption = "Eurostat indicator: bop_fdi6_flow")

fdiPS %>% filter(partner!="RU") %>% group_by(time) %>% summarise(values = sum(values, na.rm = TRUE)) %>% ggplot(mapping = aes(x = time, y = values)) + geom_line() + scale_x_continuous(breaks=unique(fdiPS$time), name = "") + scale_y_continuous(labels = comma, name = "") + labs(title= "EU direct investment flows, by partner country ", subtitle = "Post-Soviet only, excluding Baltic republics and Russia", caption = "Eurostat indicator: bop_fdi6_flow")

Same as above, but alternative visualization with barcharts

fdiPS %>% group_by(time) %>% summarise(values = sum(values, na.rm = TRUE)) %>% ggplot(mapping = aes(x = time, y = values)) + geom_col() + scale_x_continuous(breaks=unique(fdiPS$time), name = "") + scale_y_continuous(labels = comma, name = "") + labs(title= "EU direct investment flows, by partner country ", subtitle = "Post-Soviet only, excluding Baltic republics", caption = "Eurostat indicator: bop_fdi6_flow")

fdiPS %>% filter(partner!="RU") %>% group_by(time) %>% summarise(values = sum(values, na.rm = TRUE)) %>% ggplot(mapping = aes(x = time, y = values)) + geom_col() + scale_x_continuous(breaks=unique(fdiPS$time), name = "") + scale_y_continuous(labels = comma, name = "") + labs(title= "EU direct investment flows, by partner country ", subtitle = "Post-Soviet only, excluding Baltic republics and Russia", caption = "Eurostat indicator: bop_fdi6_flow")