3 Control dependencies with renv
For production readiness — and project safety — it is important to control the dependencies of a piece of development. This can be done at project level using the package renv
.
In an renv
project, dependencies are resolved and tracked in a lock-file. As a new R session starts, renv
detects whether installed dependencies are out of sync compared to the lock-file, ensuring the same virtual environment applies each time the project is opened.
This approach ensures that the set of dependencies is collaboratively shared and maintained. Moreover, it can be used to align the development environment to the production stage. Managing and controlling dependencies all the way up from development to production improves reproducibility and empowers automated deployments, a key requirement in enterprise.
Finally, as the control is at project level, it is possible to have different virtual environments (with different packages version) for different projects, while keeping the maintenance of the versioned package library efficient through caching.