The renv
package is a new effort to bring project-local R dependency management to your projects. The goal is for renv
to be a robust, stable replacement for the Packrat package, with fewer surprises and better default behaviors.
Underlying the philosophy of renv
is that any of your existing workflows should just work as they did before – renv
helps manage library paths (and other project-specific state) to help isolate your project’s R dependencies, and the existing tools you’ve used for managing R packages (e.g. install.packages()
, remove.packages()
) should work as they did before.
- 環境中安裝renv套件 & 啟動
install.packages("renv")
library(renv)
2. 呼叫 renv::init() 建立初始環境
renv::init()
3.正常使用R的各項功能,並儲存程式碼成.R檔,利用 renv::snapshot() 快照目前有使用的套件,會被新增到renv.lock中
renv::snapshot()