Skip to content

Repository files navigation

Template for RStudio on Binder / JupyterHub

Binder

Generate a Git repository that can run R code with RStudio on the browser via mybinder.org or any JupyterHub from this template repository!

How to use this repo

1. Add a Dockerfile to your repo with contents like so:

FROM rocker/binder

COPY install.r install.r
RUN Rscript install.r

2. Install any packages you want

You can create an install.r file that will be executed on build. Use install.packages() to install:

install.packages("ggplot2")

Binary versions of packages will be quickly installed from r2u via bspm. There is no need to manually manage 'system' dependencies with apt-get, these are handled automatically in the Docker build phase.

Commonly used packages in the tidyverse and geospatial collection are already installed, see install.r and the base image's own install.r.

3. Modify the Binder Badge in the README.md

The 'Launch on Binder' badge in this README points to the template repository. You should modify it to point to your own repository. Keep the urlpath=rstudio parameter intact - that is what makes sure your repo will launch directly into RStudio

A note on the base image

This image is a thin layer over rocker/ml-spatial, which provides Ubuntu 26.04, R + RStudio Server, code-server, and a /opt/venv Python environment.

It is not conda-based. Earlier versions of rocker/binder derived from jupyter/minimal-notebook and shipped conda at /opt/conda; that is gone, and conda/mamba are not available. Python packages are managed with pip/uv against /opt/venv:

RUN uv pip install --no-cache-dir some-package

Geospatial work links a single system GDAL with the Arrow/Parquet drivers enabled, shared by R (sf, terra, stars) and Python (geopandas, rasterio, pyogrio) alike, so (Geo)Parquet round-trips between them.

About

RStudio on Binder / JupyterHub

Resources

Stars

71 stars

Watchers

9 watching

Forks

Packages

Used by

Contributors

Languages