I am new to renv
and setting up project environments in R.
I want specific version of certain libraries in my renv.lock() and here's the workflow that I am using:
Initialising an environment.
Loading my packages.
Snapshot.
library(renv)
renv::init()
library(lidR)
library(tidyverse)
library(GGally)
library(tidymodels)
library(randomForest)
library(patchwork)
library(stringr)
library(caret)
renv::snapshot()
But the generated lock file contains all global packages also, which I don't want in my lock file.
renv
includes the packages you use, as well as their recursive dependencies, within the lockfile. So:
library(renv)
packages <- c(
"lidR",
"tidyverse",
"GGally",
"tidymodels",
"randomForest",
"patchwork",
"stringr",
"caret"
)
deps <- tools::package_dependencies(packages, recursive = TRUE)
sort(unique(unlist(deps)))
gives a total of 177 recursive package dependencies.
system
Closed
January 11, 2022, 5:49am
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.