This help topic is for R version 1.1. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/Startup.html
Startup {base}R Documentation

Initialization at Start of an R Session

Description

In R, the startup mechanism is as follows. If a file ‘.Renviron’, or failing that ‘~/.Renviron’, exists, it is sourced, usually to set environmental variables. This is suppressed by the flag --no-environ. Then R searches for the site-wide startup profile unless the command line option --no-site-file was given. The name of this file is taken from the value of the ‘R\_PROFILE’ environment variable. If that variable is unset, the default is ‘\$R\_HOME/etc/Rprofile’.

Then, unless --no-init-file was given, R searches for a file called ‘.Rprofile’ in the current directory or in the user's home directory (in that order) and sources it.

It also loads a saved image from ‘.RData’ if there is one (unless --no-restore was specified).

Finally, if a function .First exists, it is executed as .First().

The functions .First and .Last can be defined in the appropriate startup profiles or reside in ‘.RData’.

The command-line flag --vanilla implies --no-init-file, --no-restore and --no-environ.

Usage

.First <- function() { ...... }

.Rprofile <startup file>

See Also

.Last for final actions before termination.


[Package base version 1.1 ]