data(africa_trade)
head(africa_trade)
# Number of trading pairs
length(unique(paste(africa_trade$iso3_o, africa_trade$iso3_d)))
# Total trade by section
aggregate(value ~ section_name, data = africa_trade, FUN = sum)
# Largest bilateral flows
africa_trade[order(-africa_trade$value), ][1:10, ]
# Trade between specific countries
subset(africa_trade, iso3_o == "ZAF" & iso3_d == "NGA")
Run the code above in your browser using DataLab