[R] .First.lib

Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com
Sat Nov 18 20:10:10 CET 2006


Perseverance, I guess, is the answer.

Thank you exceedingly Professor Ripley for your help.  Things do look
awfully simple on this side of success.  At your suggestion (after several
false starts) I defined a .First.lib function within a file named zzz.R and
built with R CMD build --binary, loaded the new package and there were my
new menus.

Thanks again.

Sheepishly,

Charles Annis, P.E.

Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Charles Annis, P.E.
Sent: Saturday, November 18, 2006 1:54 PM
To: 'Prof Brian Ripley'
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] .First.lib

Thank you Professor Ripley.  I don't have compiled code and do not have a
namespace, which is required (I understand) to use onLoad.  The package is
of moderate size, however with about 100 R functions.  I know that I could
emulate the technique used by Rcmdr, but had hoped to use R CMD build
--binary.

Should I just declare a namespace and use onLoad, or is there a mechanism to
use my own .First.lib?

Charles Annis, P.E.

Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 
-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] 
Sent: Saturday, November 18, 2006 12:53 PM
To: Charles Annis, P.E.
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] .First.lib

On Sat, 18 Nov 2006, Charles Annis, P.E. wrote:

> Greetings:
>
> I'm running R version 2.4.0 (2006-10-03) on WindowsXP in a 3 year old DELL
> box with 2 gig.
>
> I have successfully created a zipped package, mh1823_2.1.zip, using R CMD
> build --binary mh1823.
>
> R CMD build --binary  automatically adds a file, mh1823, containing
> .First.lib and its default function definition.

How does it do that?  (I've never seen it do so.)  What it is documented 
to do is to create a binary package with a file mh1823/R/mh1823 which 
contains code you put in the package sources, so I am pretty sure you 
defined .First.lib.

> I would like to supply my own .First.lib function to create menus when the
> package is loaded by calling my menu-creator function.  It is easy to do
> after the package is installed from mh1823_2.1.zip, but I want my
.First.lib
> function to be part of mh1823_2.1.zip in the first place.
>
> Is there a way that I can use R CMD build --binary, with its zip file
> output, but substitute my .First.lib function for the default?

All packages that I am aware of on CRAN which use compiled code have their 
own .First.lib or .onLoad, normally in file R/zzz.R.

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

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list