[R] Introduce a new function in a package?

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Apr 6 18:24:59 CEST 2005


On Wed, 6 Apr 2005, roger bos wrote:

> I tried making a package on windows and got a "make" error, so I was
> happy I was able to get source("mystuff.R") to work in .First().
> Since my utility functions are pretty simple and few in number, this
> is good enough for me for now.
>
> But I got a curious error.  I can submit the command
> "memory.size(3*1024)" at the command line and it works fine (I
> modified my header file to make R \LARGEADDRESSAWARE), but if I put
> that same command in .First R says it can't find a function
> memory.size in the environment.  Can anyone recommend a cause and/or
> work around?

The last thing done in the startup is to load the default packages, so 
only base is loaded when .First is run. memory.size is in utils, so you 
need utils::memory.size.  See ?Startup ....

HOWEVER, it would be better to use --max-mem-size as part of the shortcut 
or alias you use to start R since saved data is loaded before .First is 
run.

-- 
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