Message-ID: <1426cd88-88c0-2214-4f37-bea043cd46cb@gmail.com>
Date: 2018-02-24T23:53:42Z
From: Duncan Murdoch
Subject: [R-pkg-devel] How to (conditionally) use an archived package (without Suggests)?
In-Reply-To: <CAM3-KjbUK=zk-HZAp2nD-s28aiqWjeK4SCQiLaUC3cn9op5Jvw@mail.gmail.com>
On 24/02/2018 6:45 PM, Marius Hofert wrote:
> Hi,
>
> 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 1.1.3.1.
>
> 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
That should be fine, as long as your package still works when "bar" is
unavailable. That is, use requireNamespace in a conditional:
if (requireNamespace("bar", quietly = TRUE)) {
# do the good stuff
} else {
# do some less good substitute
}
without generating an error anywhere.
>
> '::' or ':::' import not declared from: ?bar?
> 'loadNamespace' or 'requireNamespace' call not declared from: ?bar?
Right, you shouldn't refer to a package in code without mentioning it in
the DESCRIPTION file.
>
> Does this mean it is not possible to use 'bar' anymore in 'foo'?
I don't think so. But CRAN policies may have changed...
Duncan Murdoch
>
> These are (somewhat) related references I found:
> 1) https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Suggested-packages
> 2) https://stat.ethz.ch/pipermail/r-devel/2013-February/065947.html
>