How to Map Trade Routes with R

preview_player
Показать описание
Do you want to learn how to create stunning trade routes maps using a huge database of international trade data? In this tutorial, I'll show you how to use the United Nations Comtrade database, which contains over 1.5 billion records of trade flows between countries. You'll learn how to use ggplot2 in R to create great circles that show the trade relationships of the largest wheat exporters in 2022.

Chapters

0:00 Intro
00:44 Packages
03:32 Comtrade API
06:17 Search Comtrade database
08:15 Wheat exports for Ukraine
10:29 Explore data
12:08 Fetch capitals
15:23 Start/end points
19:36 Create lines
22:15 Merge data
23:23 World shapefile
24:21 Points
26:13 Map 1 - no labels
42:19 Map 2 - labels
46:13 Multiple exporters
49:44 Add reporter iso
50:09 Multiple start/end points
50:29 Map 3 - trade network
55:01 Final thoughts

Check the full code in my GitHub repo:

Follow my work on Instagram:

Let's connect on X:

If you like my work, consider buying me a coffee:

Comtrade website:

Music credits:
---------------------------------------------------------------------------------------------------
Music By: massobeats - midnight (lofi aesthetic music)
Рекомендации по теме
Комментарии
Автор

Great video. I wasnt active in mapping for the last two month i will work on this for the first project in 2024. I did it in Python for different commodity before. It is good to learn also how to do in R. Thanks Alot for posting.

mahatmaalimibrahim
Автор

Another great tutorial! Keep it up Milos!

AleksPopovic
Автор

Hi Milos! As usual, thanks a lot for your great work! I just want to mention something that happened on my side when I declared the "partner" as "all". As soon as I ran the code I got this error "!The following partner you provided are invalid: all".

I solved it by changing it to "all_countries".

Cheers from Costa Rica!

ekku