Install R/Bioconductor packages in RStudio using renv package manager (Windows)
The `renv` package (
https://rstudio.github.io/renv/articles/renv.html) allows project-wise package management in R. This is useful when working on multiple R projects with different dependencies, and sharing these environment across users or VMs. In order to be able to use `renv` in the DRE, we had to adjust multiple settings in `Rprofile.site` (located, e.g., at `C:/ProgramFiles/R/R4.0.3/etc/`). The following is working as of 2022-06-20 with R 4.0.3/Bioconductor 3.12, and R4.1.1/Bioconductor 3.14.
- As explained in https://support.mydre.org/portal/en/kb/articles/r-and-rstudio, CRAN and Bioconductor mirrors need to be defined in Rprofile.site, and corresponding ports (443 for https, 80 for http - check mirror addresses) need to be opened (https://support.mydre.org/portal/en/kb/articles/opening-up-ports). Example:
- The download.file.method needs to set to `libcurl`.
- For Bioconductor, `BiocManager` and `BiocVersion` need to installed (`install.packages(c("BiocManager", "BiocVersion"))`).
- We tried setting `BIOCONDUCTOR_ONLINE_VERSION_DIAGNOSIS` to `FALSE`, and `BIOCONDUCTOR_CONFIG_FILE` to a local copy of https://bioconductor.org/config.yaml, but couldn't manage to get `BiocManager::validate()` to work. However, linking to the Bioconductor software packages in the `repos`option allows installing packages with `install.packages()` instead of `BiocManager.install()`.
- For using `renv`, RENV_DOWNLOAD_FILE_METHOD needs to set to `libcurl` (or in this case `getOption("download.file.method")`.
This currently allows installing R and Bioconductor packages in RStudio, before and after installing (`install.packages("renv")`) and activating `renv` with `renv::activate()`. It still needs to tested if the project environment can be succesfully restored in the DRE, too (`renv::restore()`).
I'm attaching a copy of my current Rprofile.site and would be happy to hear of others' experiences or suggestions.