23 October 2026
Data + code != reproducible
Data + code + environment = reproducible
[1] "G"
opts? What are opts?
Error in `opts()`:
! could not find function "opts"
ggplot2 0.9.2
----------------------------------------------------------------
THEME SYSTEM
* The `opts()` function has been renamed to `theme()`.
Figure 1
values were analysed in R (R Core Team, 2017) using the qqman package (Turner, 2014).
To cite R in publications use:
R Core Team (2026). _R: A Language and Environment for Statistical
Computing_. R Foundation for Statistical Computing, Vienna, Austria.
doi:10.32614/R.manuals <https://doi.org/10.32614/R.manuals>.
<https://www.R-project.org/>.
A BibTeX entry for LaTeX users is
@Manual{,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2026},
doi = {10.32614/R.manuals},
url = {https://www.R-project.org/},
}
We have invested a lot of time and effort in creating R, please cite it
when using it for data analysis. See also 'citation("pkgname")' for
citing R packages.
To cite lme4 in publications use:
Douglas Bates, Martin Maechler, Ben Bolker, Steve Walker (2015).
Fitting Linear Mixed-Effects Models Using lme4. Journal of
Statistical Software, 67(1), 1-48. doi:10.18637/jss.v067.i01.
A BibTeX entry for LaTeX users is
@Article{,
title = {Fitting Linear Mixed-Effects Models Using {lme4}},
author = {Douglas Bates and Martin M{\"a}chler and Ben Bolker and Steve Walker},
journal = {Journal of Statistical Software},
year = {2015},
volume = {67},
number = {1},
pages = {1--48},
doi = {10.18637/jss.v067.i01},
}
Numerical analyses were carried out using R v. 2.15.3 (R Core Team 2013) using the vegan package v. 2.0-9 (Oksanen et al. 2013).
Which packages to cite?
Potentially hundreds of packages used directly and indirectly.
Using pakret package
Numerical analyses were carried out using R version 4.6.1 [@base] using the ‘vegan’ package version 2.7.5 [@vegan].
renv for reproducible R environmentdetect which packages you use and their dependencies
keeps a lockfile - a list of the version of ALL the packages installed
makes a project library
will install correct version of packages in the lockfile when you start using a project
renvrenv::init()library() callsrenv::install() (both CRAN and GitHub)renv::status()renv::snapshot() to save changes or renv::restore() to revertrenvrenv::restore() to install packagesrenv only valid for the version of R it was built onlibrary(dplyr), tidyr::nest(...) and dependenciessolution use targets::tar_renv()
solution use R file with library() calls
Don’t forget to renv::update() packages to get bugfixes.
renv limitationsrenv makes the list of packages available.
Does nothing for the all the external dependencies.
You want to reproduce a paper using R 3.6.3 …
Virtual machines vs containers
Containers
docker
podman
singularity/apptainer
Use for reproducibility, production, high-performance computers
Download and install podman from https://podman.io/
Test it is working:
Docker images are snapshots of a computer system
Can be downloaded and used
Images can be stacked
Images have version control
---
config:
flowchart:
padding: 10
---
flowchart BT
ubuntu([ubuntu---])
rver([rocker/r-ver-----])
rstudio([rocker/rstudio------])
tidyverse([rocker/tidyverse------])
verse([rocker/verse-----])
geospatial([rocker/geospatial------])
geospatial-->verse-->tidyverse-->rstudio-->rver-->ubuntu
--rm remove image after use
-ti interactive
-e environmental variables
-p port
docker.io registry
rocker/rstudio:4.5.3 image & version tag
Open browser http://localhost:8787
Usename: root
Password: pass (or whatever you set)
use -v option to mount files
Files edited in container will be updated outside.
(Also possible to make files read-only)
renvMake new image from a Dockerfile
Dockerfile
Build Dockerfile into image with
Run the image with
Command line is too complex to want to write every time.
compose.yml
Run with
Use for for starting, stopping and managing images.
Nix language downloads packages
R interface with rix package
install Nix
Use rix to make Nix expression