[R] Loading packages at startup

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jan 20 16:35:12 CET 2004


On Tue, 20 Jan 2004, imap wrote:

> Hi,
> 
> I use the Windows R GUI.  I frequently use (or have my students use)
> foreign and survival packages.  I would like to make them part of the
> basic start-up package set (like base, ctest, etc.) using something
> short of recompiling a special Windows version of R.  Is this possible?  
> I examined the autoload() command but this seems to target a single
> command of package, and only apply during a single run of R.  Is there
> an initiation text file I could modify?  I can find no mention in the
> documentation of how this might be done.

There certainly is.  You can use a site profile file, or you can set
R_DEFAULT_PACKAGES.  Both are described in ?Startup (a pretty obvious
place to look, surely).  For example, you might put in 
R_HOME/etc/Rprofile.site

options(defaultPackages=c(getOption("defaultPackages"), "foreign", "survival"))


Please sort out a proper user name for your mail ....

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list