explaingit

t-kalinowski/ir

13RustAudience · dataComplexity · 2/5Setup · moderate

TLDR

A command-line tool that runs R scripts and Quarto documents in self-contained environments by reading package requirements from the script file itself, caching the setup so repeated runs start instantly.

Mindmap

mindmap
  root((ir))
    What it does
      Self-contained R environments
      Cache package libraries
      Run Quarto documents
    Commands
      ir run
      with flag for extras
      rx tool manager
    Tech Stack
      Rust
      R
      Quarto
      Cargo
    Use Cases
      Single-file R scripts
      Data analysis notebooks
      Reproducible reports
    Setup
      Shell script install
      Requires R installed
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Run a single R analysis script with its required packages defined in the file header, without setting up a project directory.

USE CASE 2

Render a Quarto report to HTML with all package dependencies resolved and cached automatically.

USE CASE 3

Temporarily add an extra package to a script run using the --with flag without modifying the file.

USE CASE 4

Install and manage R-based command-line tools using the `rx` companion command.

Tech stack

RustRQuartoCargo

Getting it running

Difficulty · moderate Time to first run · 30min

Requires R to be installed separately, optional rig (R version manager) and Quarto are needed for their respective features.

In plain English

ir is a command-line tool written in Rust that runs R scripts and Quarto documents in self-contained environments. R is a programming language popular in statistics and data science. Quarto is a document format that mixes code and text for reports and notebooks. The problem ir solves is that R scripts usually depend on external packages that have to be installed separately, and getting the right versions installed and available is often a manual or error-prone process. With ir, you put the package requirements directly into the script file itself using a comment header at the top. You list which packages you need, optionally specify minimum versions or a cutoff date for package resolution, and optionally pin an R version. When you run the file with ir run, it reads those requirements, prepares a package library in a local cache, and launches R with that library ready. If you run the same script again, ir reuses the cached setup instead of rebuilding it, so repeated runs are fast. The tool is designed for single-file workflows where you do not want to set up a whole project directory just to run one script. You can use it like a scripting tool where the file itself is the complete description of what it needs. It can also render Quarto documents to HTML or other formats, run one-off commands with extra packages added temporarily using the --with flag, and manage R-based executable tools via a companion command called rx. Installation is via a shell script on Linux and macOS or a PowerShell script on Windows. It can also be built from source using the Rust build tool Cargo. The tool requires R to already be installed on the system, and optionally rig (an R version manager) and quarto for their respective features. Full documentation is available at the project's website.

Copy-paste prompts

Prompt 1
Show me how to add an `ir` requirements header to an R script that needs tidyverse and ggplot2, then run it with `ir run`.
Prompt 2
I have a Quarto notebook using dplyr and knitr. Write the `ir` header and the command to render it to HTML.
Prompt 3
How do I use the --with flag in `ir` to temporarily add an extra R package to a script run without editing the file?
Prompt 4
Set up `ir` on macOS and show me how to pin a specific R version and a minimum package version in a script header.
Prompt 5
Use `ir`'s `rx` command to install an R-based CLI tool and explain how it differs from a regular `ir run`.
Open on GitHub → Explain another repo

← t-kalinowski on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.