0

I am trying to include a development version package in a project with renv. However the package requires the following install options

install_github("james-thorson/VAST", INSTALL_opts="--no-staged-install")

I see in the renv documentation that it is possible to supply configuration options to the install

https://rstudio.github.io/renv/reference/install.html#package-configuration

But I'm unclear how and where to include this option so that it is reproducible by other users

  1. How exactly would I pass the --no-staged-install to renv within an renv environment
configure.args = c(VAST = "install_opts=--no-staged-install")
options(configure.args = configure.args)
renv::install("james-thorson/VAST")

doesn't seem to work, neither does

options(install.opts = "--no-staged-install")
renv::install("james-thorson/VAST")
  1. Where would I then put those instructions so that when new users try and restore the repo the VAST install instructions are followed? In the .Rprofile file?
DanO
  • 600
  • 3
  • 11

1 Answers1

1

renv uses an option called install.opts for this case. From ?renv::install:

Similarly, additional flags that should be passed to R CMD INSTALL can be set via the install.opts R option:

# installation of R packages using the Windows Subsystem for Linux
# may require the `--no-lock` flag to be set during install
options(install.opts = "--no-lock")
renv::install("xml2")

In this case, I believe you can set:

options(install.opts = "--no-staged-install")
renv::install("james-thorson/VAST")
Kevin Ushey
  • 20,530
  • 5
  • 56
  • 88
  • Thanks, I tried that before with no luck but it seems to be working now on mac but not on linux, figures! My question then though is where would I specify that option so that it works for other users? i.e. when another collaborator clones the repository, and then runs `renv::restore()` to install dependencies, where in the project would I specify options(install.opts = "--no-staged-install") so that the user themselves doesn't have to enter it? And would putting it in say the .Rprofile then affect the install process of other packages that might not need that option? – DanO Oct 12 '20 at 19:33
  • 1
    This isn't documented, but you can place an R script at `/renv/settings.R`, and that script will be sourced by `renv` whenever the project is loaded. (Or, you can also just place it directly in the project `.Rprofile` as well.) – Kevin Ushey Oct 13 '20 at 06:26