Rstudio doesnn't load Rprofile or Renviron

I store my Rprofile and Renviron in non-default places (i.e. ~/.config/R). When opening R in a normal shell, my environment is loaded perfectly fine. When opening Rstudio, it doesn't load my options, settings or paths.

I've created an issue at: RStudio doesn't respect environment variables set in .zshenv · Issue #6482 · rstudio/rstudio · GitHub, but, I wanted to see if anybody has a work-around for this problem.

I've already read the page at: R for Enterprise: Understanding R’s Startup · R Views

but it doesn't really give any helpful information:

A common misconception is that R and RStudio are one in the same. RStudio runs on top of R and requires R to be installed separately. If you look at the process list while running RStudio, you’ll see at least two different processes: usually one called RStudio and one called rsession.

RStudio starts R a bit differently than running R from the terminal. Technically, RStudio doesn’t “start” R, it uses R as a library, either as a DLL on Windows or as a shared object on Mac and Linux.

The main difference is that the script wrapped around R’s binary is not run, and any customization to the script will not take affect. To see the script try:

cat $(which R)

For most people, this difference won’t be noticeable. Any settings in the startup files will still take affect. For user’s that build R from source, it is important to include the --enable-R-shlib flag to ensure R also builds the shared libraries used by RStudio.

Like I said, normal R startup in shell is fine, but Rstudio isn't seeing them.

Presumedly this works because you set R_PROFILE_USER and R_ENVIRON_USER somewhere (your .bash_profile?)

Since RStudio doesn't launch R through a shell, such environment variables won't be read from there.

Yes, but I also set that information in my Renviron too. And supposedly it Rstudio should still pick those up.

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