the negation of negation blog posts work & projects about

R Startup Profiles

It is a useful practice to customize the initialization of R. This is achieved through RPROFILE (system wide) and RPROFILE_USER (user specific) files which are both simple R scripts.

R_PROFILE is an environment variable, and by default, set to ${R_HOME}/etc/Rprofile.site. If such a file exists, it is evaluated in the global environment of your R session.

Per-user customization is achieved through the R_PROFILE_USER environment variable. After R_PROFILE has been evaluated, the file which is pointed by R_PROFILE_USER is evaluated. If R_PROFILE_USER is not set, a file named .Rprofile is searched first in the current directory, then in the user home directory. If found, it is evaluated in the global environment of your R session.

R documentation gives quite a good overview of the entire initialization process of an R session. It is recommended to read this (through ?.Rprofile) since it gives some useful hints and warnings as well.

I am keeping my own .Rprofile in my home directory. Here is the gist of it: