Customising the environment.

Users can customize their environment in several different ways. There is a system initialization file and every directory can have its own special initialization file. Finally the special functions .First and .Last can be used.

The system initialization file is called Rprofile and it is found in the . home subdirectory library. This file should contain the commands that you want to execute every time . is started under your system. A second, personal, profile file named .Rprofile[*] can be placed in any directory. If . is invoked in that directory then that file will be sourced. This file gives individual users control over their workspace and allows for different start-up procedures in different working directories.

Any function named .First() in either of the two profile files or in the .RData image has a special status. It is automatically performed at the beginning of an . session and may be used to initialise the environment. For example, the definition in Figure [*] alters the prompt to $ and sets up various other useful things that can then be taken for granted in the rest of the session.

Thus, the sequence in which files are executed is, Rprofile, .Rprofile, RData and then .First(). A definitions in later files will mask definitions in earlier files.

 
Figure:   An example of a .First() function
\begin{figure}
\hrule\medskip
\begin{verbatim}
\gt .First <- function() {
 optio...
 ...es)  ...

Similarly a function .Last(), if defined, is executed at the very end of the session. An example is given in Figure [*].
 
Figure:   An example of a .Last() function
\begin{figure}
\hrule\medskip
\begin{verbatim}
\gt .Last <- function() {
 graphi...
 ...\nAdios\n''))  ...



Jeff Banfield
2/13/1998