I will let an R project run on a data center and the team working there has no access to the Internet, so they will have to download the R libraries from an internal repository (on their Intranet) where all the packages are hosted.
- It is possible to change the repository from where the libraries are downloaded?
- and how can we point to this repository if I will provide them with my
renv.lock
file?
Could be solved by doing this? :
repos <- c(CRAN = "https://cloud.r-project.org", WORK = "https://work.example.org")
options(repos = repos)
See here
Thanks a lot
Yes, and the example code you shared is correct: the active package repositories used in an R session are controlled via the
repos
option.If you're working within an
renv
project with an auto-loader, thenrenv
will automatically set the repositories from the lockfile when R is started. Otherwise, you can callrenv::load("/path/to/project")
to explicitly load a project at some location.I'd recommend reading https://rstudio.github.io/renv/articles/renv.html for more details.