Skip to content

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

2 messages · Marius Hofert, Duncan Murdoch

#
On Sun, Feb 25, 2018 at 1:41 AM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
Hi,

the 'workaround' is the error: to tell the user not to use it (but one
of the other available methods).

To be more precise: 'bar' is the package 'loon' for dynamic graphics
(and 'foo' is 'zenplots'). If that's not installed, the user can
choose to work with the other (non-dynamic) graphics packages. If a
user actively chooses to do the plotting with loon but doesn't have
loon installed, the error is a logical consequence.
The main plotting function in zenplots uses:

    if(pkg == "loon" && !requireNamespace("loon", quietly = TRUE))
        stop("Package 'loon' is not available.")

... and if it's installed, it will call various further functions from
loon (now all used via "loon::..."). There are no tests or examples
that fail, everything works -- it's just that the use of "::"
generates the warning I mentioned which is (most likely) unacceptable
for upload to CRAN.
It does -- except for the 'warning':

'::' or ':::' import not declared from: ?bar?
'loadNamespace' or 'requireNamespace' call not declared from: ?bar?
'loon' is not in Suggests. It originally was in 'Imports', then I put
it to 'Suggests', but when I submitted, Uwe wrote:
But you still have
Suggests: loon,
Please fix and resubmit.

... so it shouldn't appear in 'Suggests' either (I guess). That's why
I also removed it from Suggests, but then (because of the above
warning), I can't submit either.

Not sure how to solve this (... and thought that others might have a
similar problem with archived packages -- thus this post).

Cheers,
Marius
#
On 24/02/2018 7:56 PM, Marius Hofert wrote:
That's because 'bar' is not in Suggests.
I suspect you didn't run an --as-cran check with no 'loon' available, 
and if you had, you would have received warnings or errors.

If you did run that check and it didn't give warnings or errors, then 
things have changed; sorry for misleading you.

Duncan Murdoch