From ddad3a224a92e889b0e0d8639a80ecf174c6bd35 Mon Sep 17 00:00:00 2001 From: James Myatt Date: Thu, 11 Oct 2018 11:46:44 +0100 Subject: [PATCH 1/3] Create install.R --- install.R | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 install.R diff --git a/install.R b/install.R new file mode 100644 index 0000000..166af26 --- /dev/null +++ b/install.R @@ -0,0 +1,3 @@ +install.packages("tidyverse") +install.packages("data.table") +install.packages("r2excel") From d58ed59df7ee201f44669a06872dddc57d88214a Mon Sep 17 00:00:00 2001 From: James Myatt Date: Thu, 11 Oct 2018 11:53:56 +0100 Subject: [PATCH 2/3] Use R snapshot from the day of the first commit --- runtime.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 runtime.txt diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000..95bedf0 --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +r-2018-07-02 From 82d82e4a2ccb60d09d828f2c8489e3a48a069caa Mon Sep 17 00:00:00 2001 From: James Myatt Date: Thu, 11 Oct 2018 12:01:32 +0100 Subject: [PATCH 3/3] Update README.md to mention Binder --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 08afd81..1833333 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ This codebook largely applies to all three files. The exception is the variables ## Calculating the Big Mac index -The code to calculate the index is provided as a [Jupyter Notebook][jupyter]. The code itself is written in R, a programming language designed for data manipulation and statistics. You can view the [notebook][notebook link] on github. +The code to calculate the index is provided as a [Jupyter Notebook][jupyter]. The code itself is written in R, a programming language designed for data manipulation and statistics. You can view the [notebook][notebook link] on github, or run it with [Binder](https://mybinder.org/v2/gh/TheEconomist/big-mac-data/master?filepath=Big%20Mac%20data%20generator.ipynb). If you want to run the notebook, you’ll need to set up a few things: @@ -141,6 +141,12 @@ Finally, our R script uses a few R packages you’ll need to install. The [tidyv > install.packages(c('tidyverse','data.table')) ``` +or + +``` +> source('install.R') +``` + You’re all set. ### Start the notebook @@ -165,6 +171,14 @@ $ R data-generator-v2.R to calculate the index files. (The R script may generate numbers that are different at the last decimal place to those from the Python notebook—these differences are due to rounding errors and can be safely ignored.) +### Run online + +The notebooks can also be run online, with no install, using [Binder](https://mybinder.org/). + +Jupyter+R: [![Binder](http://mybinder.org/badge.svg)](http://beta.mybinder.org/v2/gh/TheEconomist/big-mac-data/master) + +RStudio: [![Binder](http://mybinder.org/badge.svg)](http://beta.mybinder.org/v2/gh/TheEconomist/big-mac-data/master?urlpath=rstudio) + ### Licence This software is published by _[The Economist](https://www.economist.com)_ under the [MIT licence](https://opensource.org/licenses/MIT). The data generated by _The Economist_ are available under the [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/).