Menu

Pinning an R environment with renv so a result still rebuilds in three years
📰

Pinning an R environment with renv so a result still rebuilds in three years

DEV Community: datascience·TECHWORKSLAB·about 8 hours ago
#XLPPfmdz
#devtodatascience#science#devto#dev#renv
Reading 0:00
15s threshold

A regulator can ask you to reproduce a result years after you filed it. Not a similar result. The same one, from the same code, to the same digits. That is a high bar for R, because an R script does not carry its dependencies with it. Run it on a machine where one package has moved a minor version and an output can change in ways that are easy to miss and hard to defend.

The renv package exists for exactly this. It gives a project its own private library and writes down, in a lockfile, the exact version and hash of every package the project uses. We treat that lockfile as part of the submission record, not as developer convenience. Here is how we set it up, what it actually guarantees, and the gap you have to close yourself.

Turning a project into a pinned project

One call bootstraps it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.