rrenv

How to have a project with `renv` use the user `.Rprofile` as well as the project `.Rprofile`?


I have a lot of tidyverse-recommended settings in my user .Rprofile that I noticed are not being used inside projects with renv because renv creates a project-specific .Rprofile.

Is there a way to configure renv to always use the user .Rprofile (i.e. source it) in addition to the project .Rprofile? I don't understand this page on renv user-level configuration.

I know this is less reproducible but I'm not placing anything in my user .Rprofile that would go against reproducibility except for something like

Sys.setenv("_R_CHECK_LENGTH_1_CONDITION_" = "true")

as recommended by Hadley.


Solution

  • Yes, as the page you linked says, you need to set the option renv.config.user.profile to TRUE. It defaults to FALSE.

    There are two ways to do that.

    1. Run options(renv.config.user.profile = TRUE) in R before doing anything in renv. Putting that line in your .Rprofile file should do this.

    2. Set the environment variable RENV_CONFIG_USER_PROFILE=TRUE outside of R. How you do that depends on your system (Windows, Linux, MacOS, etc.).