Installing the R Kernel
Jupyter is language-agnostic: any kernel can run in any frontend. Adding the R kernel (IRkernel) gives you R notebooks in JupyterLab or classic notebook alongside Python - useful for statistical work, tidyverse pipelines, or mixed-language analysis.
Prerequisites
# R must be installed first; verify:
R --version
Install IRkernel
install.packages("IRkernel")
IRkernel::installspec(user = TRUE)
This registers an R kernelspec with Jupyter. Verify from the shell:
jupyter kernelspec list
# ir ~/jupyter/kernels/ir
# python3 /usr/lib/jupyter/kernels/python3
Using R in JupyterLab
- Launcher -> New -> Notebook -> R (the kernel list now includes R).
- Cells run R: libraries, tibbles, ggplot2 all work with inline rendering.
- Switch a notebook's kernel anytime via Kernel -> Change Kernel.
library(tidyverse)
mtcars %>%
head() %>%
print()
Mixing R and Python
- Separate notebooks per language, passing data through files (CSV, parquet) - the robust pattern.
- Inside one notebook, use the rpy2 bridge from Python or the reticulate package from R to call across, but keep the boundary small: cross-language calls are the fragile part.
- %%R and %%python cell magics exist (via rpy2/reticulate) to run the other language inside a cell - convenient for demos, fragile in production.
Multiple R Versions
IRkernel::installspec(user = TRUE, name = "r44", displayname = "R 4.4")
Register one spec per R installation you want to offer as a kernel choice.
Summary
Install R as a Jupyter kernel with IRkernel::installspec(user = TRUE), verify with jupyter kernelspec list, and create R notebooks from the Launcher. Use files (parquet/CSV) to pass data between R and Python notebooks, and register multiple specs to offer several R versions as kernels.