[R-pkg-devel] Package can't be imported with Suggests

William Dunlap wdun|@p @end|ng |rom t|bco@com
Thu Aug 6 01:25:08 CEST 2020


You might make a second package that depends only on nimble and your
main package can then suggest that second package and JAGS.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Aug 5, 2020 at 3:36 PM Simon Bonner <simon.bonner using uwo.ca> wrote:
>
> Hi all,
>
> I’m wondering if someone an offer advice on a problem I’m facing in developing a package.
>
> My package essentially generates code and formats data for one of two MCMC sampling engines, JAGS accessed via rjags or nimble (a native R package), calls the engines, and then provides functions to access the results. Since only one of the engines is needed I would like to include rjags and nimble in Suggests in the DESCRIPTION and use requireNamespace() to load the appropriate package when its functionality is needed.
>
> Unfortunately, nimble will not work with this mechanism. It relies on a complex mechanism to compile C++ code to run the sampler, and some of the functions cannot be found when the package is loaded in this way. I’ve been in touch with the maintainers and they are aware of the issue but the current fix is to include the package under Depends. However, this forces a user to install nimble (which itself requires compiling lengthy C++ code) even if the user intends to run the sampler in JAGS.
>
> I thought I’d solved the problem by including nimble in Suggests and then loading it via library() so that all of its functions are attached. This works, but produces a note during the check:
> ❯ checking dependencies in R code ... NOTE
>   'library' or 'require' call to ‘nimble’ in package code.
>     Please use :: or requireNamespace() instead.
>     See section 'Suggested packages' in the 'Writing R Extensions' manual
>
> What is the recommendation?
>
> I see two options:
>
>
>   1.  Include nimble in Depends and force user to install it.
>   2.  Ignore the note and explain the problem when I resubmit to CRAN.
>
> Am I missing anything?
>
> Thanks in advance!
>
> Simon
>
>
>
>
>
> Simon Bonner
> Assistant Professor of Environmetrics
> Department of Statistical and Actuarial Sciences
> University of Western Ontario
>
> Office: Western Science Centre rm 276
>
> Email: sbonner6 using uwo.ca<mailto:sbonner6 using uwo.ca> | Telephone: 519-661-2111 x88205 | Fax: 519-661-3813
> Twitter: @bonnerstatslab | Website: http://simon.bonners.ca/bonner-lab/wpblog/
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list