Could I put renv files in a subdirectory rather than the root directory at the same level as .Rproj?

Hello, first and foremost, thank you so much for making and managing the renv package! This makes collaboration with far easier and safer.

I am writing to file a request for the package. Currently I am working on a fairly large project with many others that needs the folders to be well-structured. Specifically, I have the following structure:


When I use the renv package, the package includes the following items in the root directory:
renv (folder)
renv (lock file)

As I try to keep the root folders customized and organized as much as possible, I wish to put these three files within 01_admin folder. However, if I understand correctly, renv requires these files to be located at the root directory by default. I tried to relocate to the subfolder and update some contens manually, e.g. by modifying .Rprofile path and updating activate.R script, I was at the end unable to put the renv items in a subfolder.

To make the package management even more seemless, I wonder if it is technically possible to allow the sets of renv files to be put in a subfolder.

Thank you!

Best regards,

Sorry for taking so long to respond!

The development version of renv has a new function, autoload(), which can be used to try and automatically load an renv project located within the parent directory of some sub-directory. The intention here is that you place:


into your user .Rprofile, located at ~/.Rprofile, and then when your R session starts up, if renv discovers an renv project root in a parent directory, it will automatically be loaded.

If you want to give this a try, you can install the development version of renv with:


And then call renv::snapshot() to add renv to the lockfile.

Hello - thank you so much for responding so quickly! My huge respect for the RStudio Team -- responding to all questions must be so overwhelming - with almost no time to rest (>< I'm working at the proposed solution and am a bit struggling, but let me follow up when I make further progress.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.