elf is a fairly random collection of R helpers I like to use.
# install.packages("pak")
pak::pak("dataheld/elf")You do not need Nix or direnv to run or develop this package.
[! NOTE] Developing without nix provides only limited reproducibility of the environment. The PPM date approximates the Nix package set: R package versions can differ, and neither your R installation nor system libraries are pinned by this setup.
Install R or use the version you already have.
The recommended version recorded in .Renviron.
Then open this directory in R, and start a fresh R session.
The committed .Rprofile reads .Renviron, selects the project's dated Posit
Package Manager (PPM) repository, and creates a writable library in
.R/library/<R-version>/<platform>/.
Other user and site libraries on your machine are neither affected,
nor used when the .Rprofile is used
(default behavior, unless you use R --vanilla).
Run this in the R console, from the directory containing DESCRIPTION:
source(".R/install.R")This helper installs pak and the DESCRIPTION dependencies explicitly into the project library, even if pak is already installed elsewhere. Re-run it to update dependencies. It refuses to run without the project profile or inside Nix.
The PPM resolver selects a platform-specific repository when supported; a custom repository URL is left unchanged. pak chooses binaries when available, otherwise source packages. The local library is Git-ignored; do not commit it.
The helper delegates resolution, downloads, caching and installation to
pak::local_install_deps(),
with a single lib path.
- To add or update a package, list it in
DESCRIPTION, restart R and re-run.R/install.R. - To remove a package, delete it from
DESCRIPTION, re-run.R/install.R, and optionally remove it from the project library withpak::pkg_remove("packageName", lib = getOption("nullkomma.r.library")). - Commit
DESCRIPTION.pkg.lockpins the packages for Nix; a Nix collaborator refreshes it withr-lock.