Reputation: 193
I want to use the R package BOLTSSIRR
available on GitHub in my R package, which I want to upload to CRAN.
I listed BOLTSSIRR
under Suggests:
in the DESCRIPTION
file and made the link to GitHub available using Additional_repositories: https://github.com/daviddaigithub/BOLTSSIRR
.
However, running R CMD check --as-cran
I get:
Suggests or Enhances not in mainstream repositories:
BOLTSSIRR
Availability using Additional_repositories specification:
BOLTSSIRR no ?
? ? https://github.com/daviddaigithub/BOLTSSIRR
Additional repositories with no packages:
https://github.com/daviddaigithub/BOLTSSIRR
So the GitHub link does not seem to get recognized in the check. Might I have to change something here?
Upvotes: 5
Views: 915
Reputation: 51
Answering since I cant comment. @user2554330 answer is correct, and will fix the additional package not being available. However, you may still get a NOTE about:
Package suggested but not available for checking: <yourpackage>
which you should be able to explain is a result of the drat-hosted library, but the package will not be available for e.g. vignettes/examples in checks. This note in CRAN policies still applies:
A package listed in ‘Suggests’ or ‘Enhances’ should be used conditionally in examples or tests if it cannot straightforwardly be installed on the major R platforms. (‘Writing R Extensions’ recommends that they are always used conditionally.)
In my submission I was getting errors in examples due to not being able to find a package hosted in a drat repo that was listed in Additional_repositories
. One way around this is to use @examplesIf requireNamespace("yourpackage", quietly = TRUE)
instead of @examples
in roxygen comments or conditionally run stuff in vignettes with
if (requireNamespace("yourpackage", quietly = TRUE)) {
result = yourpackage::function()
# ...
}
Upvotes: 1
Reputation: 44867
As you found, you can't use Remotes
in a CRAN package. What you need to do is to make sure the .tar.gz
file for the package you are depending on is available somewhere. Github doesn't do that automatically, because https://github.com/daviddaigithub/BOLTSSIRR
isn't set up as a package repository.
The solution is to create your own small repository, and keep copies of non-CRAN packages there. The drat
package (available here: https://github.com/eddelbuettel/drat) makes this easy as long as you have a Github account: follow the instructions here: https://github.com/drat-base/drat. In summary:
docs/
folder in the main branch.drat
package into R using remotes::install_github("eddelbuettel/drat")
. (I assume this version will make it to CRAN eventually; if you use the current CRAN version instructions are slightly more complicated.)options(dratBranch="docs"); drat::insertPackage(...)
to insert those files into your repository.Additional_repositories: https://yourname.github.io/drat
You will be responsible for updating your repository if BOLTSSIRR
is updated. This is good because the updates might break yours: after all, it's still in development mode. It's also bad because your users won't automatically get bug fixes.
That's it, if I haven't missed anything!
Upvotes: 7