Bruno Rodrigues, head of the statistics department at the Ministry of Research and Higher Education in Luxembourg
Slides available online:
https://b-rodrigues.github.io/repro_ukraine
Code available here:
The reproducibility puzzle you know
The reproducibility puzzle with Nix
{ggplot2}
4.0.0{renv}
or {groundhog}
: simple to use, but:
Package manager: tool for installing and managing packages
Package: any software (not just R packages)
A popular package manager:
{rix}
(website) simplifies writing Nix expressions!
Just use the provided rix()
function:
renv.lock
files can also serve as a starting point:rix::rix()
generates a default.nix
filenix-build
(in terminal) or rix::nix_build()
from Rnix-shell
"dplyr@1.0.0"
)scripts/nix_expressions/01_rix_intro/
scripts/nix_expressions/02_renv2nix/
scripts/nix_expressions/03_native_vscode_example/
{targets}
: scripts/nix_expressions/04_nix_targets_pipeline/
scripts/nix_expressions/05_docker/
{shiny}
: scripts/nix_expressions/06_shiny/
{rixpress}
{rix}
: output is a shell that contains required software{rixpress}
: output is whatever is the output of your pipeline (cleaned dataset, Quarto/Rmd document, model predictions, model parameters/weights, model itself…){rixpress}
allows chaining processing steps in R and Python{rix}
to create a reproducible (via Nix) execution environment for the pipelinereticulate
or universal format (CSV, JSON, Parquet…)list(
rxp_py_file(…), # Read a CSV with Python
rxp_py(…), # Filter with Polars
rxp_py2r(…), # Python → R transfer
rxp_r(…), # Transformation in R
rxp_r2py(…), # R → Python transfer
rxp_py(…), # Another Python step
rxp_py2r(…), # Back to R
rxp_r(…) # Final step
) |> rixpress()
py
, r
, r2py
, etc.)functions.R
, img…).
├── data
│ └── dataset.csv # input data (can be many files)
├── functions.py # user-defined Python functions
├── functions.R # user-defined R function
├── gen-env.R # rix script to generate execution env
├── gen-pipeline.R # rixpress script to generate pipeline
├── my_paper # folder containing Quarto doc
│ ├── section.qmd # Qmd file
│ ├── img # Folder containing img for document
│ │ └── graph.png # Image to add to paper
│ └── main.qmd # Main Qmd file
└── Readme.md # Readme
Use rxp_read()
to include pipeline outputs:
All created objects can be dynamically loaded into the document
Possible to include additional files (content.qmd
, img…)
rixpress::rxp_init()
;gen-env.R
and gen-pipeline.R
;gen-pipeline.R
and build pipeline using rxp_make()
;rxp_inspect()
;rxp_read()
(load them using rxp_load()
;rxp_ggdag()
or rxp_visnetwork()
import_nix_archive()
and export_nix_archive()
(very useful on CI!);rxp_ga()
;reticulate
See scripts/rixpress_demo
If you have questions:
Thanks!