[R] problems with compiling a package

Prof Brian Ripley
Tue, 16 Nov 2004 20:31:08 -0000

On Tue, 16 Nov 2004 r.ghezzo at staff.mcgill.ca wrote:

> Hello, I am trying to compile packages for R2.0.0 patch in a win XP
machine.

What exactly is `R2.0.0 patch'?  If you mean 2.0.0 patched, it has a date,
and the date is crucial.

> Most of the packages compile without problems, with C or FTG or only R.
> Now some packeges give the following error which I do not understand how to
> correct
> ...
> preparing package xxx for lazy loading
> Error in "names <-
.default"('*tmp*',value=c("R","Platform","Date",
:
>  names attribute[4] must be the same length as the vector [3]
> Execution halted
> make: *** [lazyload] Error 1
> ....
> Can somebody tell me how I can correct this error?

My guess is that this comes from tools:::.split_description which has

     if(!is.na(Built <- db["Built"])) {
         Built <- as.list(strsplit(Built, "; ")[[1]])
         names(Built) <- c("R", "Platform",
"Date", "OStype")
         Built[["R"]] <- package_version(sub("^R
([0-9.]+)", "\\1",
                                             Built[["R"]]))
     } else Built <- NULL

so probably your DESCRIPTION file is faulty.  Did you have a Built: line
in it that you put there yourself?  I can reproduce this by doing so.
If so, `Writing R Extensions' does say

   There should be no @samp{Built} or @samp{Packaged} fields, as these are
   added by the package management tools.

and R CMD check on such package throws an immediate error.


> One other question, this npreparing package for lazy loading does not occur
for
> all packages, although their DESCRIPTION and folders are similar, When does
a
> package goes to lazy loading and when it does not?

Please do read the NEWS (or ONEWS) file!  It says in the first 20 lines

         Packages are by default installed using lazy loading if they
         have more than 25Kb of R code and did not use a saved image.

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