- Project-based
renv
initialization script
sequenceDiagram
participant A AS system library
participant B AS project library
participant C AS lockfile
participant D AS renv cache
A->>B: renv::init()
D->>B: renv::install() or renv::update()
B->>C: renv::snapshot()
C->>B: renv::restore()
.zshrc
or .bashrc
に以下のラインを付け足し, commandのPATHを通す
% export PATH="<path>/Renv_setup:$PATH"
- 必要なパッケージを行単位で
package_template
以下のファイルに入力する - 最後のラインに空行を忘れずに(parseの関係上必要)
devtools
ggplot2
languageserver
tidyverse
rmarkdown
Projectの開始
% renv_init <package-template>
Packageのinstall
## shellscript
% Rscript -e "renv::install('MASS')"
## package install via R
renv::install('MASS')
## from github repository
renv::install("eddelbuettel/digest")
## update packages
renv::update()
Packageのremove
# remove digest from library
renv::remove("digest")
分析環境の保存
renv::snapshot()
分析環境の再現
# check library status
renv::status()
# restore lockfile, thereby reinstalling digest 0.6.19
renv::restore()