19 What happens when R starts?
When R loads itself it parses some start up files that allow the
user to store user changes to the environment and frequently used
commands. The documentation for these files is accessed with the
In particular, the user may store frequently used commands in a file
called .RProfile. This file is searched for in the current
directory and if not found the users home directory. This file should
contain R code. There are special functions though. If the
functions .First or .Last are found, they are executed
as the first (or last) thing done in an R session. As a simple
example, if the .RProfile file was
.First <- function() print("Hola")
.Last <- function() print("Hasta La Vista")
Then when starting R and quitting your screen might look something
R is free software and comes with ABSOLUTELY NO WARRANTY.
[Previously saved workspace restored]
Save workspace image? [y/n/c]: n
 "Hasta La Vista"
Process R:2 finished...
More useful things for this file are of course quite possible.
Copyright © John Verzani, 2001-2. All rights reserved.