R never reloads a package if not asked to, and it is usually users (not R)
who `get confused'.
Specifying Suggests: multtest just tells 'check' that it needs to be
available: it does not tell R to load it. (It also tells install.packages
enough to install it if you asked for dependencies to be installed.)
This appears to stem from an error in multtest. The example-checking
tests (and not R generically) do try to reset the environment after each
example, and that includes detaching packages that the example caused to
be loaded. Detaching a package does not unload its DLL, but a package's
.Last.lib can do so. However, multtest does so incorrectly, via a call to
dyn.unload not library.dynam.unload.
Namespaces will not help as multtest does not have one (at least in the
version I looked at).
I suggest R-devel would be a better list for questions about developing
packages. (But for now please take this up with multtest maintainer.)
On Wed, 1 Feb 2006, Alexander Ploner wrote:
> I have been running R CMD check for the first time on of our own
> packages, which otherwise builds, installs and runs just fine. The
> package depends on package akima and suggests package multtest;
> suggesting multtest is indicated because a) it loads a lot of other
> Bioconductor packages, very slowly, and b) it is only needed for one
> specific subroutine, which executes require(multtest) every time it's
> called.
>
> Now, when I run R CMD check on our package, it terminates when
> checking the examples in the documentation, claiming that
>
> Error in .C("get_stat", as.double(tmp$X), as.integer(tmp$m),
> as.integer(tmp$n), :
> "C" function name not in DLL for package
'multtest'
> Execution halted
>
> A closer look at the output in the -Ex.Rout file shows that this
> does indeed happen when calling the function mt.teststat in multtest,
> to which this piece of code belongs. It also shows however, that this
> only happens in the *second* chunk of example code containing the
> calling function; before that, three calls to the offending function
> in the first chunk (ie in a different .Rd file) are executed just
> fine. Furthermore, if I change the status of multtest from Suggests
> to Depends in the DESCRIPTION file, R CMD check processes our package
> without problem.
>
> My impression is that R gets confused when re-loading multtest for
> the second chunk of example code (for what it's worth, the
> offending .C("get_stat"...) does have a PACKAGE argument).
>
> My question now: Is there any way of avoiding this problem without
> loading multtest by default? Would e.g. using a namespace help? If
> so, how specifically? Etc.?
>
> Thanks for your time (and expertise),
>
> alexander
>
>
> platform powerpc-apple-darwin7.9.0
> arch powerpc
> os darwin7.9.0
> system powerpc, darwin7.9.0
> status Patched
> major 2
> minor 1.0
> year 2005
> month 05
> day 12
> language R
>
>
> Alexander.Ploner at ki.se
> Medical Epidemiology & Biostatistics
> Karolinska Institutet, Stockholm
> Tel: ++46-8-524-82329
> Fax: ++46-8-31 49 75
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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
>
--
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