rrenv

renv: install R packages without help pages & Co


With R's install.packages(), it is possible to exclude certain parts of a package, which are only helpful during development - such as help pages and example data - to yield lightweight runtime environments (e.g. smaller Docker images):

install.packages('data.table',
                 INSTALL_opts = c('--no-docs', '--no-help', '--no-html', '--no-data'))

Now, I am wondering, if such a feature exists also for renv (and I was just too blind to find it on the web)?


Solution

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

    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")
    

    You can also use the package name in the option, e.g.

    options(install.opts = list(xml2 = <...>))
    

    if you wanted package-specific installation options; e.g. you wanted to exclude vignettes for certain packages.