[R] .First.lib doesn't appear to be running after calling library()
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Oct 7 16:38:30 CEST 2003
On Tue, 7 Oct 2003, Crispin Miller wrote:
> 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?
Don't use a file name starting with a dot. Assuming this is Unix and R
1.7.1, INSTALL does
Rfiles=`LC_COLLATE=C ls R/*.[RSqrs] R/${R_OSTYPE}/*.[RSqrs] 2>/dev/null`
and ls will omit file names starting with a dot.
`Writing R Extensions' says
The @file{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 @file{.R}, @file{.S}, @file{.q}, @file{.r}, or
@file{.s}.
but it seems we don't quite enforce that on either Unix nor Windows.
--
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