R Environments

boks runs R via Alpine's R package — there's no per-minor-version selection the way Python/Node have (Alpine ships one current R release), so boks R always runs against that version.

The tool name is capital R, matching the real command on Linux (there's no lowercase r binary; Rscript is a separate, non-interactive command that boks uses under the hood).

Inline packages

Append :pkg1,pkg2 to install R packages before running:

boks R:dplyr,ggplot2 script.R

renv.lock

boks -e @renv:renv.lock R script.R

boks reads renv.lock, restores the packages into the image, caches it, and runs the script.

Auto-detect

boks -e @renv R script.R    # finds renv.lock in CWD

Shebang scripts

#!/usr/bin/env -S boks R:dplyr

library(dplyr)

mtcars |>
  group_by(cyl) |>
  summarise(mean_mpg = mean(mpg)) |>
  print()
chmod +x script.R
./script.R

Native packages

Many CRAN packages compile native C code — R has no wheel-equivalent prebuilt-binary system. boks handles this the same way it does for Python's wheel-less packages: package installs build against a compiler-having variant of the R image, kept separate from the small image a bare boks R pulls.