This repo has been archived. For more information refer to rOpenSci curation policy.
For using Binder with R we suggest trying out holepunch
Computational reproducibility is a critical component of modern open science. Methods such as docker exist to containerise analyses, ensuring that operating systems and package versions are recorded and can be recreated in order to rerun analyses. Setting up dockerfiles, however, is a nontrivial task on top of a growing technical barrier to reproducible research.
binder is a handy alternative, that:
- builds a Docker image for your Github repo, and
- hosts a live environment on JupyterHub server, accessible via a reusable link.
As an alternative to using docker itself, the benefit of binder is that it requires only an internet connection to use. The binder live repository allows anyone to replicate your research with the same computing environment and package versions as you used when you built it. Setting up binder, while straightforward, still requires researchers to search through their code to find package names, source, and versions used to create an install.R file that loads these into the virtual environment.
bindertools is a little R helper that seeks to make the bridge to binder for analyses in R even simpler by setting up the install.R file with all packages and versions (both for CRAN and github packages) in one step. The online binder can also be launched right from R, without needing to manually input repository information into the mybinder.org interface.
bindertools has two key functions:
build_binder()builds a runtime.txt file and an install.R file that contains code to install all required CRAN and Github packages mentioned in any .R and .Rmd file.
launch_binder()launches your live repository at mybinder.org in an RStudio session and also returns the html webpage that you can then send as is, or record in a github repo with a README button as follows:
[![Binder](http://mybinder.org/badge.svg)](COPY HTML LINK RETURNED BY launch_binder() HERE)
You can install
bindertools as follows:
Let's say our project is contained in a local directory called
~/toy_project that we want to reproduce in a live session on binder.
In just three steps, we can do so with
build_binder(directory = "~/toy_project"), which will create our runtime.txt and install.R files.
git pushin the terminal or using the Git pane in RStudio to push the two added files to your Github repo.
- run the following to launch:
launch_binder(github_username = 'my_username', repo_name = 'toy_project', branch_name = 'master')
Then in the browser you should see a live RStudio session populated with data same as