[R] Loading user defined functions autometically each time I start R

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Wed Feb 27 11:06:38 CET 2008


> I wrote some user defined function for my own. Now I want to get a 
mechanism
> so that every time I start R, those function will automatically be 
loaded in
> R without manually copying pasting. Can gurus here pls tell me how to do
> that? Or I have to build my own packages bundled with those functions.

These instructions are for Windows, there may be a slight difference on 
other platforms.

In R_HOME\etc you should have a file named RProfile.site.

Inside this file, you can define a .First function, which sources your 
functions, e.g.

.First <- function()
{
    source("c://myfunction.r")
}

See also:
Section 10.8 of the Intro to R manual, and
http://cran.r-project.org/doc/contrib/Lemon-kickstart/kr_first.html

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}



More information about the R-help mailing list