Reputation: 159
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.
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
Upvotes: 8
Views: 3891
Reputation: 357
I found myself in the situation where my private repos were set, but whenever I ran renv::init()
, it wouldn't point to them. The simplest solution I could come up with from reading the renv
docs:
renv::init()
, call the function: Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE")
.Sys.setenv("RENV_CONFIG_REPOS_OVERRIDE" = "your_private_package_repository_url")
renv::init()
Upvotes: 4
Reputation: 21315
- It is possible to change the repository from where the libraries are downloaded?
Yes, and the example code you shared is correct: the active package repositories used in an R session are controlled via the repos
option.
- and how can we point to this repository if I will provide them with my renv.lock file?
If you're working within an renv
project with an auto-loader, then renv
will automatically set the repositories from the lockfile when R is started. Otherwise, you can call renv::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.
Upvotes: 4