Here is the R code and data used to create this short story on How countries differ in their sport representation at the Rio Summer Olympics.
The code and data provided is on github as a personal archive and because I wish to make the method used transparent. Frankly, if you wish to rerun this code be mentally prepared for major frustrations! One reason the code is pretty convoluted is one script (03_athletesBySport.Rmd) will generate the interactive graphic in 9 languages.
Because of time constraint and laziness, I needed to get something as quickly as possible. The code uses many experimental packages/features. Furthermore, it currently uses 3 packages that are really just for personal use. I didn't expect that much interest for these graphics and code! :-)
One could importantly reduce dependencies/number of packages. But for now, this is the messy code I used.
The code has been quickly written to publish a story as rapidy as possible. No guarantee is offered of its completeness, correctness or up-to-date nature. No liability is accepted for damage or loss incurred from the use of this script or the information drawn from it. This exclusion of liability also applies to third-party content that is accessible via this offer.
Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
If you have questions please write an email to ducquang.nguyen(at)swissinfo.ch or on Twitter