For those who don’t know it, MyBinder is a reproducible research automation tool that will take the contents of a Github repository, build a Docker container based on requirements files found inside the repo, and then present the user with a temporary, running container that can serve a Jupyter notebook, JupyterLab or RStudio environment to the user. All at the click of a button.
Although the primary, default, UI is the original Jupyter notebook interface, it is also possible to open a MyBinder environment into JupyterLab or, if the R packaging is install, RStudio.
For example, using the demo https://github.com/binder-examples/r repository, which contains a simple base R environment, with RStudio installed, we can use my Binder to launch RStudio running over the contents of that repository:
When we launch the binderised repo, we get — RStudio in the browser:
Part of the Binder magic is to install a set of required packages into the container, along with “content” documents (Jupyter notebooks, for example, or Rmd files), based on requirements identified in the repo. The build process is managed using a tool called
repo2docker, and the way requirements / config files need to be defined can be found here.
To make building requirements files easier for R projects, the rather wonderful
holepunch package will automatically parse the contents of an R project looking for package dependencies, and will then create a
DESCRIPTION metadata file itemising the found R package dependencies. (
holepunch can also be used to create
install.R files.) Alongside it, a Dockerfile is created that references the
DESCRIPTION file and allows Binderhub to build the container based on the project’s requirements.
For an example of how
holepunch can be used in support of academic publishing, see this repo — rgayler/scorecal_CSCC_2019 — which contains the source documents for a recent presentation by Ross Gayler to the Credit Scoring & Credit Control XVI Conference. This repo contains the Rmd document required to generate the presentation PDF (via
knitr) and Binder build files created by
Clicking the repo’s MyBinder button takes you, after a moment or two, to a running instance of RStudio, within which you can open, and edit, the presentation
.Rmd file and
knitr it to produce a presentation PDF.
In this particular case, the repository is also associated with a Zenodo DOI.
As well as launching Binderised repositories from the Github (or other repository) URL, MyBinder can also launch a container from a Zenodo DOI reference.
The screenshot actually uses the incorrect DOI…