reflowR

Themed extensions for workflowr research workflows

Overview

reflowR extends the workflowr package with themed colour schemes, structured analysis pipeline templates, and utility scripts for reproducible research. It wraps workflowr::wflow_start() to create a standard workflowr project, then layers on a complete theming and scaffolding system.

Theming

Scaffolding

All generated projects remain fully compatible with standard workflowr commands (wflow_build(), wflow_publish(), etc.).

Installation

reflowR is not on CRAN yet. Install it from GitHub:

if (!requireNamespace("pak", quietly = TRUE)) install.packages("pak")
# pak::pak("CTTIR/reflowR")
install.packages("reflowR", repos = c('https://cttir.r-universe.dev', 'https://cloud.r-project.org'))

Quick Start

library(reflowR)

# The generated setup requires here in addition to reflowR.
if (!requireNamespace("here", quietly = TRUE)) install.packages("here")

# Choose a new project directory.
dir.create("~/projects", recursive = TRUE, showWarnings = FALSE)
project <- reflow_init(
  directory = "~/projects/my_analysis",
  author    = "Your Name",
  email     = "you@example.com",
  scheme    = "clinical",
  depth     = "standard",
  change_wd = FALSE,
  open      = FALSE
)

# Then use standard workflowr commands:
workflowr::wflow_build(project = project)
workflowr::wflow_publish(file.path(project, "analysis", "*.Rmd"),
                        message = "Initial build",
                        project = project)

The explicit project argument and project-qualified analysis paths work from your current directory; initialization does not need to change it. Choose a new destination for this example. Generated code/00_setup.R reports any additional packages needed by individual analysis helpers. Install those packages before using the corresponding helpers; the scaffold does not install them automatically. Publishing with workflowr commits the reviewed analysis and rendered files locally; remote hosting is a separate setup step. The optional table helpers use gtsummary >= 2.0.0, which requires R >= 4.2; core reflowR remains available on R >= 4.1.

Generated save_versioned() checkpoints retain their second-resolution names. A same-name, same-second collision is refused and the earlier checkpoint is preserved. Loading matches the exact step name, including punctuation, then selects the latest modification time among matching timestamped files. Serialization completes in a temporary file before publication, so a failed write does not leave a partial named checkpoint. This is not a guarantee for concurrent writers or power-loss recovery. numeric_summary() reports n = 0 with NA estimates for empty or entirely missing numeric columns.

Colour Schemes

Scheme Label Accent Use Case
spectral Spectral imaging #0072B2 Imaging, spectroscopy
spatial Spatial biology #009E73 Tissue and spatial assays
omics Molecular data #CC79A7 Sequencing, molecular profiles
clinical Clinical science #D55E00 Clinical trials, patient data
methods Learning & inference #56B4E9 Statistical and ML methods
simulation Systems & simulation #E69F00 Simulation studies, models
evidence Evidence & discovery #F0E442 Reviews, meta-analyses
platform Research infrastructure #000000 Software, data, infrastructure
brand Science, connected #0072B2 General purpose (default)

The earlier names basic, code, special and other remain accepted as aliases of brand, methods, evidence and platform. Links and text use neutral tokens in light and dark mode; the accent marks identity only.

Preview any scheme interactively:

reflow_preview("clinical")
reflow_schemes()

Depth Presets

Preset Steps Best For
minimal 3 Quick explorations, side analyses
standard 8 Standard research projects, publications
extended 12 Clinical trials, comprehensive studies
reflow_presets()

How It Works

reflowR calls workflowr::wflow_start() to create the standard workflowr scaffold, then enhances it with themed files. The result is a standard workflowr project -- all workflowr commands work as expected.

Getting Help

Citation

citation("reflowR")

Contributing

Contributions are welcome. Please open an issue first to discuss what you would like to change, then submit a pull request.

License

MIT

Recorded imaging workflows

The imaging API runs a sequential graph of exported package functions, with explicit references to upstream R objects. It is independent of workflowr scaffolding and does not create Git repositories or publish anything.

plan <- reflow_imaging_plan(
  reflow_imaging_stage("summary", "base", "summary", list(object = 1:4)),
  reflow_imaging_stage("mean", "base", "mean",
                      list(x = reflow_imaging_ref("summary")))
)
run_dir <- tempfile("imaging-run-")
results <- reflow_imaging_run(plan, run_dir)
verified <- reflow_imaging_resume(plan, run_dir)

Use reflow_imaging_input(path) for tracked files or directories, or set read = TRUE to pass an RDS input as an object. Use the reference's select argument to extract named nested components. Declare optional package backends with the plan's packages argument and stochastic calls with a stage seed.

Receipts record configuration, input, installed code, runtime and output hashes. Resume verifies completed results; changed inputs or corrupt results require a new run directory. Common numerical thread environment settings are recorded and changes invalidate resume; this does not measure effective backend thread counts or capture in-process thread setters. Failed or interrupted calls retry in new attempt directories. A lock prevents concurrent execution; stale locks require manual inspection. Inputs must remain immutable during execution. Calls must be trusted, return plain serializable R objects, and avoid external side effects: this is not a sandbox. Resource scheduling, file-producing stages, external engine provenance, review dashboards and report recipes are not yet implemented by this API.

Use of LLM tools

Where applicable, LLM tools were used for narrowly defined, non-authorial tasks: copyediting, prose refinement, Markdown/LaTeX formatting, boilerplate scaffolding (such as CI configurations and build scripts), and code refactoring. Tools included Chat AI, the KISSKI (GWDG) service, and self-hosted Mistral Small (24B, Apache-2.0) served through a local vLLM architecture on an Ubuntu Linux workstation with Intel processors and NVIDIA GPUs. The self-hosted model ran locally, with no data sent to third parties.

All scientific claims, methodological choices, analyses, interpretations and conclusions remain the authors' own. Where applicable, LLM-generated material must be reviewed and revised before inclusion, and references must be verified against their DOI, arXiv ID or ISBN.

Local software setup: vLLM with Python/PyTorch, plus R and RStudio.

Branding

Editable R artwork and regeneration instructions are in tools/branding.

TODO after removing the local container setup