Re: [R] R script autoload at startup

From: Prof Brian Ripley <>
Date: Tue 28 Feb 2006 - 01:31:59 EST

On Mon, 27 Feb 2006, javier garcia-pintado wrote:

> Thank you very much Prof Brian R,
> I also wonder how I missed that.
> Anyway, In my .Rprofile file:

>> .First <- function() cat ("\n Welcome to R!\n")

> works perfectly, while:
>> .First <- function() winMenuAdd("Newmenu")

> give me the answer:
> "Error in .First(): couldn't find function "winMenuAdd"
> I just can add the new menu, and create the menu entries later, calling a source() that adds the menus.
> Perhaps the functions to add menus to the RGUI are called after the .RProfile is red?

> To add it via the .Rprofile would be perfect, but anywat, to be able to
> create the menu calling manually a source after the GUI is completely
> started is good enough for me.

You need to specify the package at that point, as when .First is run the default packages are not yet loaded (see ?Startup for the precise description). E.g. (untested, as I am using Linux)

.First <- function() utils::winMenuAdd("Newmenu")

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Tue Feb 28 01:45:40 2006

This archive was generated by hypermail 2.1.8 : Tue 28 Feb 2006 - 03:08:54 EST