Reputation: 11
Recently I built an R package and wanted to publish it in CRAN. I had checked it in my local machine (WIN10 R>=3.6) and it showed there was 0 WARNING, 0 NOTE and 0 ERROR. Then I uploaded it to the CRAN. However, the CRAN CHECK showed that I had one WARNING in LINUX: here is the raw log.
Flavor: r-devel-linux-x86_64-debian-gcc
Check: package dependencies, Result: WARNING
Requires orphaned package: 'flare'
The package flare
is in the "Imports". I checked the R POLICIES and found it said "Orphaned CRAN packages should not be strict requirements". However, if I change the dependency to "Suggests", I cannot use the function slim
in the package flare
. How can I adjust it so that I can pass the CRAN CHECK?
Upvotes: 1
Views: 650
Reputation: 368201
The standard use of a package in Suggests:
is to test it before you use it. So for a function bar()
from package foo
, change your code from
res <- bar(a,b,c) # foo in NAMESPACE as imports
to
res <- NA
if (requireNamespace("foo", quietly=TRUE) {
res <- foo::bar(a,b,c) # package foo in Suggests
} else {
warning("Would need foo for bar") # message optional
}
There is no other way to appease the CRAN check. (Besides adopting the orphaned package but that is a whole different ball game.)
Upvotes: 4