[R-pkg-devel] Errors from Suggests or Enhances not in mainstream repositories
On Tue, Jul 3, 2018 at 5:57 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
On 02/07/2018 6:13 PM, Ben Bolker wrote:
I got something similar. I have a few thoughts:
(1) you should use "if (require(citrus)) { ... }" in your examples;
"Suggests" and "Enhances" packages are supposed to be *optional*, i.e.
examples and tests should be able to run even if they're not installed
Nowadays 'if (requireNamespace("citrus")) { ... }' would be preferred in
tests and examples, along with a 'citrus::' prefix on the objects from that
package that are needed. This has milder side effects than `require()`.
And requireNamespace("citrus", quietly = TRUE) is even slightly better
since it avoids one more side-effect ;)
Hadley