# Install from GitHub
library(devtools)
::install_github("mkearney/rmd2jupyter")
devtools
# Load the package
library(rmd2jupyter)
Creating Interactive (Jupyter) Notebooks
Introduction
This tutorial demonstrates how to create interactive Jupyter Notebooks—an essential tool for combining code, output, and narrative in a single, dynamic document. These notebooks enable researchers to perform analyses online, improve transparency, and enhance reproducibility in linguistic and data science research.
It is intended for researchers working with language data, especially those in the humanities and social sciences. It is particularly useful for beginner to intermediate R users who want to document their work clearly and share it in a readable, executable format.
R Notebooks provide a flexible interface for combining Markdown text and executable code. They allow users to:
- Run code interactively
- View output inline
- Export polished reports in HTML, PDF, or Word
By the end of this tutorial, you’ll understand how to:
- Structure a notebook with Markdown
- Use and execute R code chunks
- Render your notebook as a reproducible document
- Share notebooks as interactive online tools
We’ll also explore the differences between R Notebooks and Jupyter Notebooks, how to use version control, and how to share analyses using Binder.
Generating Interactive Notebooks
Markdown documents can serve as the basis for interactive notebooks. These are created from a GitHub repository using a template provided by the Australian Text Analytics Platform (ATAP) and the Language Data Commons of Australia (LDaCA).
This process involves “Dockerizing” the GitHub repository, essentially creating a virtual environment based on your project setup. The interactive notebook is then deployed via Binder, allowing others to run and edit your code in the cloud.
Sessions are temporary and reset once closed, but users can download copies.
Interactive notebooks can be used for:
- Teaching materials (e.g., for statistics, R, or text analytics)
- Transparent analysis sharing (e.g., with collaborators or reviewers)
- Interactive documentation of computational methods
- Creating accessible online tools
Most importantly, they enable reproducible workflows by letting others run your code and verify your results.
Requirements
Before creating an interactive notebook, make sure you have:
- A complete R project with an R Markdown (
.Rmd
) file
- A dedicated file named
rmd2jupyter.Rmd
for conversion
- A GitHub account to host your repository
⚠️ Important notes:
Use only one programming language per notebook (e.g., R, Python, or Julia).
Ensure all datasets and resources are stored in the GitHub repo.
It’s recommended to generate interactive notebooks once the project is complete.
Step 1: Prepare the Rmd File
Duplicate your
.Rmd
file. You can name it something likemyfile_cb.Rmd
.Remove the YAML metadata from the top of the file. Jupyter notebooks don’t use YAML headers. Instead, begin with a first-level header (
# Title
).Adjust the structure:
- Ensure all headers use appropriate Markdown syntax.
- Replace installation code chunks with a separate script (e.g.,
install.R
) to list required packages.
Step 2: Convert Rmd to Jupyter Notebook
- Open
rmd2jupyter.Rmd
and install the required package:
Use the rmd2jupyter() function to convert your file:
::rmd2jupyter("myfile_cb.Rmd") rmd2jupyter
This creates a .ipynb (Jupyter notebook) file in your project directory.
Step 3: Set Up GitHub Repository with Binder
Log in to GitHub and visit: https://github.com/Australian-Text-Analytics-Platform/r-binder-template
Click Use this template → Create a new repository.
Open the install.R file and specify which packages to install, e.g.:
install.packages("dplyr")
install.packages("tidytext")
Upload your .ipynb notebook file and any required data files using Upload files.
If you need to create subfolders, upload a dummy file and then replace it.
Step 4: Launch the Notebook via Binder
Once all files are uploaded: Navigate to this URL format to launch your interactive notebook:
https://mybinder.org/v2/gh/
Replace:
with your GitHub username with the repository name with the filename of your notebook
You can now share this link with collaborators or students.
Alternatively, you can upload your .ipynb file to Google Colab, but be aware that Colab sessions may disconnect for long-running or memory-intensive tasks.
Notes on First Launch
The first launch may take 5–60 minutes depending on the number of dependencies.
Simpler notebooks load faster but still need time to build the Docker image.
Once initialized, subsequent launches will be much faster.
Citation & Session Info
Schweinberger, Martin. 2025. Creating Interactive (Jupyter) Notebooks. Brisbane: The University of Queensland. url: https://ladal.edu.au/tutorials/jupyter/jupyter.html (Version 2025.08.05).
@manual{schweinberger2025notebooks,
author = {Schweinberger, Martin},
title = {Creating Interactive (Jupyter) Notebooks},
note = {tutorials/jupyter/jupyter.html},
year = {2025},
organization = {The University of Queensland, School of Languages and Cultures},
address = {Brisbane},
edition = {2025.08.05}
}
sessionInfo()
R version 4.4.2 (2024-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
time zone: Australia/Brisbane
tzcode source: internal
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] rmd2jupyter_0.1.0 devtools_2.4.5 usethis_3.1.0
loaded via a namespace (and not attached):
[1] miniUI_0.1.1.1 jsonlite_1.9.0 compiler_4.4.2 renv_1.1.1
[5] promises_1.3.2 Rcpp_1.0.14 later_1.4.1 yaml_2.3.10
[9] fastmap_1.2.0 mime_0.12 R6_2.6.1 knitr_1.49
[13] htmlwidgets_1.6.4 profvis_0.4.0 shiny_1.10.0 rlang_1.1.5
[17] cachem_1.1.0 httpuv_1.6.15 xfun_0.51 fs_1.6.5
[21] pkgload_1.4.0 memoise_2.0.1 cli_3.6.4 magrittr_2.0.3
[25] digest_0.6.37 rstudioapi_0.17.1 xtable_1.8-4 remotes_2.5.0
[29] lifecycle_1.0.4 vctrs_0.6.5 evaluate_1.0.3 glue_1.8.0
[33] urlchecker_1.0.1 sessioninfo_1.2.3 pkgbuild_1.4.6 rmarkdown_2.29
[37] purrr_1.0.4 tools_4.4.2 ellipsis_0.3.2 htmltools_0.5.8.1