

   Startup {base}                               R Documentation

   IInniittiiaalliizzaattiioonn aatt SSttaarrtt ooff aann RR SSeessssiioonn

   DDeessccrriippttiioonn::

        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.
        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' (`RPROFILE' as used by older ver-
        sions is now deprecated) environment variable.  If that
        variable is unset, the default is `$R_HOME/etc/Rpro-
        file'.

        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' in case 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'.

        Command-line flag `--vanilla' implies `--no-init-file'
        and `--no-restore'.

   UUssaaggee::

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

        .Rprofile <startup file>

   SSeeee AAllssoo::

        `.Last' for final actions before termination.

