How to Configure R
Apart from accepting the options in the installation procedure for R, you can change a number of startup options by adapting the Rprofile.site file. This file is located inside the installation directory, in the subfolder /R-n.n.n/etc (for example, /R-2.14.1/etc). The file is sourced by R at startup, so all R code in this file is carried out.
The default installation of R contains a perfectly valid Rprofile.site file, so you have to change this only if you want to personalize your startup.
Rprofile.site is a normal text file, so you can edit it as you would any other text file. The file already contains some options that are commented out, so you get a good idea of what’s possible when you open the file in a text editor (such as Notepad). Be sure to check the Help page ?options to get more information on all possible options.
You can personalize R further by adding a code file called .Rprofile to your personal home folder. You can find this folder from within R by setting the working directory to "~/", like this:
> setwd("~/") > getwd()  "C:/Users/Joris FA Meys/Documents
Adding an .Rprofile file isn't necessary, but R will always look for one, either in the folder from which you call R or in the user’s home directory. Whereas an Rprofile.site file is linked to a specific installation of R, the .Rprofile file can differ for every user on the same system.
If you update R, you can leave the .Rprofile file where it is and the new R version will automatically find it and apply the options you specified there. So, after updating R to the latest version, you have to adapt the Rprofile.site again only if you want to personalize it.
Functions you define or objects you create with code in Rprofile.site won’t be visible if you use ls(), although you can use them without trouble. This also means you can’t delete them easily from the workspace.
An Rprofile.site or .Rprofile file may look like the following example:
# Sample profile file # Set CRAN mirror to a default location options(repos = "http://cran.uk.r-project.org") # R interactive prompt options(prompt="R: ") # sets work directory back to original go.home <- function() setwd("D:/MyWorkspace")
With this file, R will start up with a different prompt (R: instead of >) and set the server from the UK as the default server from which to install packages. You also define the go.home() function, which you can use at any point to set your working directory back to your home directory (D:/MyWorkspace, in this example.