Getting started with renv: some issues I experienced

Hi all,

Some months ago, I tried to get started with renv. I really appreciate the authors' effort for creating reproducible environments! However, I have given up after multiple issues arose.

My R version was 4.6.0. My renv version was 1.2.3.


First, in the way how I structure my directory, I always assume that a sourced script's directory is the working directory (wd). Because renv sets the wd to the project root, according to what I've read and some advice from my LLM agent, I am supposed to use an setwd(...) command at the start of every script, which I do not like. Fortunately, I discovered renv::autoload() as an alternative, which follows up the directory hierarchy until finding a project root.

A second issue that occurred was that renv created .Rprofile files at the root of every project, blocking the user profile in my home folder. It seems that this may be circumvented by simply sourcing the home directory. However, it is followed by the third issue: Rstudio does not activate a renv environment when switching to a new working directory, so this requires one to include a line renv::load(here::here()) in every script (which I still do not like).

Finally, I ran into an issue similar to the one described here: Seeming discrepancy between renv::status() and renv::restore() - Stack Overflow. This happened after installing Bioconductor packages for the analysis of genomic count data, and dependencies.


I share the first three issues to show why I found renv a bit difficult to work with. The last issue is why I gave up.

Not using renv is not an acute problem for my analysis; I have not suffered any problems with version conflicts in my R packages yet. However, for reproducibility, it would be better to get it to work, of course. I share this here more to share user experience than to point out a bug (which would be sent to GitHub).

Also, I am attending the RaukR course in Sweden next week, so probably I will have another go with renv there!