[R-pkg-devel] How to manage using different packages if available (suggests - imports)
The following problem:
there are three packages foo1, foo2 and foo3 to use with the update of a
package. The availability depends on the configuration of the host
system. f.e java version
If I write in the Description
...
Suggests: foo1, foo2, foo3
....
inside of functions if have:
functionfoo <- function(data,usingpackage {
.....
foo1, foo2 and foo3
if (usingpackage == "foo1") {
do_something
}
.....
if (usingpackage == "foo2") {
do_something
}
....
if (usingpackage == "foo3") {
do_something
}
....
}
But of course it is not possible to get a positive check result.
It starts either with the missing package at suggest statement
or if I remove the suggest statement there is an error
'::' or ':::' imports not declared from:
?foo1? ?foo2? ?foo3?
'loadNamespace' or 'requireNamespace' calls not declared from:
?foo1? ?foo2? ?foo3?
Any hints to solve this issue?