[R-pkg-devel] How to (conditionally) use an archived package (without Suggests)?

Marius Hofert marius.hofert at uwaterloo.ca
Sun Feb 25 01:26:51 CET 2018

On Sun, Feb 25, 2018 at 1:09 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
> On 25 February 2018 at 00:45, Marius Hofert wrote:
> | A package 'foo' uses a package 'bar' (in Imports). 'bar' has been
> | archived and the maintainer of 'foo' was asked to fix the dependency
> | on 'bar' according to WRE
> |
> | Working with 'bar::' everywhere (and requireNamespace("bar", quietly =
> | TRUE)), as well as moving 'bar' from Imports to Suggests seems to work
> | but is not accepted on submission. Removing 'bar' also from Suggests
> | leads to
> |
> | '::' or ':::' import not declared from: ‘bar’
> | 'loadNamespace' or 'requireNamespace' call not declared from: ‘bar’
> |
> | Does this mean it is not possible to use 'bar' anymore in 'foo'?
> Your title says "conditionally".
> Does your code actually behave conditionally, ie does foo check if bar is
> available, and only use its code if it is?

Hi Dirk,

nice to hear from you and thanks for helping!

Yes, 'foo' essentially has one main function with an argument 'method
= c("b", "ba", "bar")'. If the user chooses to call the function with
method = "bar", then it is checked whether "bar" is installed (as
described in WRE) and an error is thrown if not.

> One additional difficulty may be that even for Suggests, it still has to be
> accessible "somewhere" .

The full story is this: 'bar' has been archived because 'problems were
not corrected despite reminders'. 'bar' is mainly developed on github
and is probably easy to fix, but I also couldn't reach the maintainer
and I thought it's better to 'decrease' the dependency on 'bar' as
much as possible. 'bar' is actually quite intrusive to install/use
(requires R to be configured with tcltk). However, 'bar' provides some
nice features which the other methods ("b", "ba") don't have -- would
be a pity to completely remove 'bar' from 'foo'.

So 'bar' is on github (and thus could be installed from there + 'foo'
could make use of 'bar' conditionally... just don't know how to submit
'foo' to CRAN because of the warning)


> And "archived" is not.  You could just move bar
> onto a drat repo you set yp -- we have done the same for data packages and
> have a R Journal paper describing it:
>    https://journal.r-project.org/archive/2017/RJ-2017-026/index.html
> Hth, Dirk
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the R-package-devel mailing list