Reload .Renviron or .Rprofile from an active R session (without restarting R)?

r

Solution

Use `readRenviron` Reference: http://stat.ethz.ch/R-manual/R-devel/library/base/html/readRenviron.html

Yes I remember getting stuck on Sys.getenv a while ago. and thanks to your question, it reminded me about packrat. Going to use it to distribute some code for a manuscript.

Problem

When R starts (with default options), it loads the `.Rprofile` and `.Renviron` files in the working directory or user's home directory. In my case these files may be changed during the course of the R session (e.g. as packrat does). I was wondering if there is a way to ask R to simply refresh its `.Renviron` having to quit and restart R? For instance, in the case of `.Rprofile`, it is sufficient to simply `source(".Rprofile")` to reload the `.Rprofile` from the working directory. Can something similar be managed for `.Renviron`?

Original source