ir
ir runs self-describing R scripts and renders or previews Quarto sources.
Put the packages and R version next to the code, then run the file.
ir resolves the requirements, prepares a cached package library, and starts R with that library ready to use.
#!/usr/bin/env -S ir run
#| packages:
#| - dplyr
#| - tidyr==1.3.1
#| r-version: ">= 4.3"
#| isolated: true
#| exclude-newer: "2024-02-01"
airquality |> tidyr::drop_na(Ozone) |> dplyr::count(Month)
ir run script.R
./script.R
This records a last-known-good environment: tidyr is pinned to the version tested with the script, while the snapshot date selects dplyr and the transitive dependencies.
Full documentation: https://r-lib.github.io/ir/
Why use it?
- The file explains itself. R and Python package requirements live in the script or document, not in a separate setup note.
- Fast by design.
irkeeps package setup direct and reuses cached resolutions and libraries when the same requirements are seen again. - Reproducibility is explicit. Use frontmatter
r-version,--r-version, orIR_R_VERSIONto select R by version. Use--rscriptorIR_RSCRIPTonly when you need a machine-local Rscript override. Use--exclude-newer,IR_EXCLUDE_NEWER, or frontmatterexclude-newerto resolve the default CRAN and Bioconductor repositories from Posit Package Manager snapshots as of a specific date. Without another R selector, the date selects the latest R minor released by then. Whenr-versioncan match more than one R minor, the date limits selection to minor versions released by then. - It works with normal R habits. Forward
Rscriptoptions, render or preview Quarto documents, evaluate inline expressions, or use--withfor one-off packages. - Package tools are easy to try. Run package executables with
rx, or install persistent launchers backed by a durable tool store.
ir is designed to be small, fast, and predictable: resolve once, reuse cached libraries aggressively, and avoid making you manage a project directory for a one-file workflow.
Common commands
ir run script.R
ir run --vanilla script.R
ir render report.qmd --to html
ir preview report.qmd
ir run --with cli -e 'cli::cli_alert_success("works")'
ir run --with BiocGenerics -e 'library(BiocGenerics)'
ir run --r-version 4.3 script.R
ir run --exclude-newer 2024-02-01 script.R
rx btw --help
ir tool run --from btw btw --help
ir tool install btw
ir cache dir
Bioconductor packages use their bare package names. pak selects the Bioconductor release compatible with the selected R.
Install
Install from PyPI with uv:
uv tool install r-lib-ir
This installs both ir and rx. If the uv tool executable directory is
not already on PATH, run uv tool update-shell.
Install a pre-built binary on Linux or macOS:
curl -fsSL https://raw.githubusercontent.com/r-lib/ir/main/scripts/install.sh | sh
Install on Windows with Scoop using the r-bucket bucket:
scoop bucket add r-bucket https://github.com/cderv/r-bucket.git
scoop install ir
Alternatively, install the Windows binary directly from PowerShell:
irm https://raw.githubusercontent.com/r-lib/ir/main/scripts/install.ps1 | iex
The direct installers download the latest release and install ir and rx into ~/.local/bin on Unix or $HOME\bin on Windows.
On macOS, the default ~/.local/bin directory is added to ~/.zprofile when needed.
On Windows, the install directory is added to the user PATH.
On Linux, the installer tells you if the install directory is not on PATH.
If rig is not on PATH, the installers print platform-specific rig install guidance.
Set IR_NO_MODIFY_PATH=1 to skip PATH changes.
Set IR_INSTALL_DIR to choose another directory.
You can also build from source with Rust:
cargo build --release
This builds target/release/ir and target/release/rx.
Development setup
To install the system dependencies needed to build the project and run tests on a new machine, run:
scripts/install-dev-deps.sh
On Windows PowerShell, run:
.\scripts\install-dev-deps.ps1
The setup scripts install Rust, Python, rig, the current R release, R 4.3 for
the version-selection and documentation example tests, and Quarto. They do not
run tests or pre-warm package caches. Pass --dry-run on Unix or -DryRun on
Windows to inspect the plan.
Requirements
R/RscriptonPATH, or--rscript/IR_RSCRIPT, when R is not selected by version or date.rigonPATHwhen usingr-version,IR_R_VERSION,--r-version, or date-onlyexclude-newerR selection.quartoonPATH, orIR_QUARTO, when rendering or previewing.qmd,.Rmd, or R script files.
On first use, ir prepares its resolver tooling in its cache, so you do not need to pre-install pak or renv.
Learn more
For command details, configuration, and edge cases, see:
- Scripts
- Quarto rendering and preview
- Package tools
- Cache management
- Install and configuration
- CLI reference
License
MIT. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file r_lib_ir-0.4.0-py3-none-win_amd64.whl.
File metadata
- Download URL: r_lib_ir-0.4.0-py3-none-win_amd64.whl
- Upload date:
- Size: 818.8 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09bafb59219a66ed871d8313a28864bed1823e6fd967d0eeb93bdfc862fdb81f
|
|
| MD5 |
d1587e7c0e132554e63fd75f7d49605a
|
|
| BLAKE2b-256 |
18da012e728ef0664bacf04824c1d67735bb30c37e98f48db7e711f919600b0a
|
File details
Details for the file r_lib_ir-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: r_lib_ir-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 954.6 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40b70899e5e1dcda43b6e5a0b253f80c1bd838d1bab3273be98a1ac07256bdd1
|
|
| MD5 |
ec643af636f2db4c5a02f291e485b3ce
|
|
| BLAKE2b-256 |
75a11036b7826f51b373b1d8515e8da8d2d4538e8f31f29e5513ed09526fa15d
|
File details
Details for the file r_lib_ir-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: r_lib_ir-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 900.6 kB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
138188e2f3de7339f391b9dfacd094820aa0c309f4a00942b7362f629708a851
|
|
| MD5 |
d678ef94a71f99e970b7f43d4cd779d2
|
|
| BLAKE2b-256 |
e616f01efa30f26a25befffa70323f723e26d055d90fb5e229793b55244ce63a
|
File details
Details for the file r_lib_ir-0.4.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: r_lib_ir-0.4.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 886.0 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b914d0392b8e354d3b1fb3167ffdf7e46800ab3402d5cbd1589cea5576a260f
|
|
| MD5 |
80015d0f03cd5254d6b2e007e6c05926
|
|
| BLAKE2b-256 |
7115078087e358a6c775a3b6ca1d12c9397dc093fb953e10bf77264bc6fde68e
|
File details
Details for the file r_lib_ir-0.4.0-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: r_lib_ir-0.4.0-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 922.0 kB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
760b6ad95877c2af0f12a0080eb6532da4fd2cd45cb01645955ae521575693a5
|
|
| MD5 |
fc673c5054c47685016e920b43b9d41c
|
|
| BLAKE2b-256 |
da6b97bc707c5695acdc006e6bceeddcd32790e1a4eb56cdaefaa0d9b4e5de52
|