[R] .First.lib doesn't appear to be running after calling lib rary()

Liaw, Andy andy_liaw at merck.com
Tue Oct 7 16:32:29 CEST 2003


>From the R-exts manual:

====
The R subdirectory contains R code files. The code files to be installed
must start with a (lower or upper case) letter and have one of the
extensions .R, .S, .q, .r, or .s. We recommend using .R, as this extension
seems to be not used by any other software. It should be possible to read in
the files using source(), so R objects must be created by assignments. Note
that there need be no connection between the name of the file and the R
objects created by it. If necessary, one of these files (historically zzz.R)
should use library.dynam() inside .First.lib() to load compiled code. 
====

So the problem is the "." that the filename starts with.

HTH,
Andy

> From: Crispin Miller [mailto:CMiller at PICR.man.ac.uk] 
> 
> Hi - so I've dusted off the C bits of my brain and gotten a 
> library written for my package...
>  
> It passes R CMD check ok, and I've put a file called 
> '.First.lib.R' in the pacakge's 'R'  subdirectory. Its 
> permissions are 644.
> 
> It says:
> 
> .First.lib <- function(lib,pkg) {
>    library.dynam("foo",pkg,lib);
>    require(affy,quietly=TRUE);
> }
> 
> 
> I build and INSTALL the package, start R and then call 
> library(foo). I deduce that my '.First.lib' isn't running 
> because the affy library doesn't get loaded - and neither 
> does my dynamic library (which complies ok and results in 
> 'foo.so' being put in the 'src/' directory of the package)...
> 
> Any ideas what I'm doing wrong?
> 
> Crispin
>  
> --------------------------------------------------------
> 
>  
> This email is confidential and intended solely for the use 
> o...{{dropped}}
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
>




More information about the R-help mailing list