Customizing your R software startup

Customizing your R software startup helps you do the following.
Thus it helps you to boot up R faster.
It automatically loads packages that you use regularly (like a R GUI -Deducer, Rattle or R Commander), set a CRAN mirror that you mostly use or is nearest for downloading new packages, and set some optional parameters.

Everytime you start R Instead of doing this , loading same R packages, setting a CRAN mirror,setting some new functions- the user needs to do this just once by customizing the R Profile SITE file.

This is done by editing the $R_HOME/etc/Renviron file for globally setting a default or the .Renviron file that is created in your home directory for a shared system.

There are two special functions you can customize in these files.
.First( ) will be run at the start of the R session and
.Last( ) will be run when the R session is shutting down.

When R starts up, it loads the .Rprofile file in your home directory and executes the .First() function.

Where is the R Profile file?
It is located in the \etc folder of your R folder- folder you installed R in.
In Windows the folder will be of the format -”C:\Program Files\R\R-x.ab.c\etc”
where x.ab.c will be the R version number (like 2.11.1)
Example
.First <- function(){
library(rattle)
rattle()
cat(“\nHello World”, date(), “\n”)
}

will automatically start the Rattle GUI for data mining and print Hello World with the date in your session.

You can also modify the Rcmd_environ file in the same \etc folder if you are particular on your settings

## Default browser
R_BROWSER=${R_BROWSER-‘C:\Documents and Settings\abc\Local Settings\Application Data\Google\Chrome\Application\chrome.exe} ## Default editor EDITOR=${EDITOR-${notepad++}}

will change the default Web browser to Chrome and the default editor to Notepad++ which is an enhanced Code Editor.

Author: Ajay Ohri

http://about.me/ajayohri

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: