Startup                 package:base                 R Documentation

_I_n_i_t_i_a_l_i_z_a_t_i_o_n _a_t _S_t_a_r_t _o_f _a_n _R _S_e_s_s_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     In R, the startup mechanism is as follows. If a file `.Renviron',
     or a file pointed to by `R_ENVIRON' or `~/.Renviron', exists, it
     is processed 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-data' was specified, or `--no-restore').

     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 commands history is read from the file specified by the
     environment variable `R_HISTFILE' (default `.Rhistory') unless
     `--no-restore-history' was specified (or `--no-restore').

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

_U_s_a_g_e:

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

     .Rprofile <startup file>

_S_e_e _A_l_s_o:

     `.Last' for final actions before termination.

