Open Trade Statistics v6.0 is publicly available!

Wait 5 sec.

[This article was first published on pacha.dev/blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. If this post is useful to you I kindly ask a minimal donation on Buy Me a Coffee. It shall be used to continue my Open Source efforts. The full explanation is here: A Personal Message from an Open Source Contributor.You can send me questions for the blog using this form and subscribe to receive an email when there is a new post.I added 2023 trade data and GDP information besides new plots that I think are more easy to understand than the previous ones: https://shiny.tradestatistics.io.Updated dashboardBack in 2017, I needed to download tradedatasets and realised that obtaining access to UN Comtrade in Latin America was particularly hard because local universities lacked institutional access to those.I mentioned this to colleagues at PUC Chile and decided to email the United Nations to ask for permission to get the data with a 48 hrs access so that I could download it and reshare the datasets. They agreed that I could share a derived dataset with cleaning/transforming steps but not reshare the raw data, and I did that. I cleaned the dataset as much as I could and used mirrored flows for consistency (i.e., importer-based figures are more reliable).Nine years later, this project continues and it is rewarding to get emails from Latin America and other developing regions that use this. For the record, I never formally studied IT or Computer Science. I learned SQL, Nginx, and REST APIs by reading Stack Overflow and experimenting to create this service.You can download the data from the website in CSV/Excel format or install the R package from CRAN with:install.packages("tradestatistics")The package documentation covers multiple examples (https://docs.ropensci.org/tradestatistics/articles/basic-usage.html). Here is a simple example:library(tradestatistics)library(dplyr)library(tidyr)library(ggplot2)# Bilateral aggregate trade between the United Kingdom, France and Germany 2020-2023yr mutate( trade_flow = recode(trade_flow, "trade_value_usd_exp" = "Exports", "trade_value_usd_imp" = "Imports" ) )ggplot(yr2, aes(x = year, y = trade_value_usd / 1e9, fill = trade_flow)) + geom_col(position = "dodge") + facet_wrap(~partner_name, ncol = 2) + labs( title = "UK bilateral trade with France and Germany", subtitle = "2020-2023, in billion USD", x = "Year", y = "Trade value (billion USD)", fill = "Trade flow" ) + theme_minimal(base_size = 13) + theme(legend.position = "top") + tintin::scale_fill_tintin_d() To leave a comment for the author, please follow the link and comment on their blog: pacha.dev/blog.R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.Continue reading: Open Trade Statistics v6.0 is publicly available!