\Header{Startup}{Initialization at Start of an R Session}
\alias{RProfile}{Startup}
\alias{.First}{Startup}
\keyword{environment}{Startup}
\begin{Usage}
\begin{verbatim}
.First <- function() { ...... }
\end{verbatim}
\end{Usage}
\begin{Description}
In \R, the startup mechanism is as follows.  \R\ first searches for the
site-wide startup profile unless the command line option
\texttt{--no-site-file} was given.  The name of this file is taken from the
value of the \file{RPROFILE} environment variable.  If that variable is
unset, the default is \file{\$RHOME/etc/Rprofile}.

Then, unless \texttt{--no-init-file} was given, \R\ searches for a file
called \file{.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 \file{.RData} in case there is one
(unless \texttt{--no-restore} was specified).

Finally, if a function \texttt{.First} exists, it is executed as
\texttt{.First()}.

The functions \texttt{.First} and \texttt{\Link{.Last}}
can be defined in the appropriate startup profiles or reside in
\file{.RData}.\end{Description}
\begin{SeeAlso}
\texttt{\Link{.Last}} for final actions before termination.\end{SeeAlso}

