Session Initialization
In the preceding sections, we described how to allow the server to discover multiple versions of R to be used by the user. The R environment is loaded before the session begins execution, and several files are executed along the way that can cause problems with your R Environment if any variables are incorrectly set.
When a session is launched, the following steps occur:
- If the file /etc/rstudio/rsession-profileexists, it is sourced.
- If the R Version being loaded specifies a module to load, the user’s ~/.bashrcfile is sourced and the module is loaded using themodule loadcommand.
- If the R version being loaded specifies a prelauch script to run, it is sourced.
- A bash login shell is created, which sources the ~/.bash_profile,~/.bash_loginor the~/.profilescript, whichever is found first to exist (in that order).
- The session is launched with the environment constructed in steps 1-4.
As you can see, there are many different scripts which can affect the R environment which gets initialized when starting a new session, so play close attention to how these scripts could be affecting your particular environment.