使 CRAN R 包建议 GitHub R 包
Make CRAN R package suggest GitHub R package
我想在我的 R 包中使用 GitHub 上可用的 R 包 BOLTSSIRR
,我想将其上传到 CRAN。
我在 DESCRIPTION
文件的 Suggests:
下列出了 BOLTSSIRR
,并使用 Additional_repositories: https://github.com/daviddaigithub/BOLTSSIRR
使 link 到 GitHub 可用。
然而,运行 R CMD check --as-cran
我得到:
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
所以 GitHub link 似乎没有在检查中得到识别。我可能需要在这里更改一些内容吗?
如您所见,您不能在 CRAN 包中使用 Remotes
。您需要做的是确保您所依赖的包的 .tar.gz
文件在某处可用。 Github 不会自动执行此操作,因为 https://github.com/daviddaigithub/BOLTSSIRR
未设置为包存储库。
解决方案是创建您自己的小型存储库,并在那里保留非 CRAN 包的副本。 drat
包(可在此处获取: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。总而言之:
- 将 https://github.com/drat-base/drat 分叉到您的帐户中,并将其克隆到您自己的计算机上。
- 在主分支中启用 Github 个包含
docs/
文件夹的页面。
- 使用
remotes::install_github("eddelbuettel/drat")
将 drat
包安装到 R 中。 (我假设这个版本最终会进入 CRAN;如果您使用当前的 CRAN 版本,说明会稍微复杂一些。)
- 构建您要插入的包。您需要源版本;如果您的用户难以构建二进制文件,您可能也需要二进制文件。
- 运行
options(dratBranch="docs"); drat::insertPackage(...)
将这些文件插入您的存储库。
- 提交更改,并将它们推送到 Github。
- 在需要使用该非CRAN包的包中,添加
Additional_repositories: https://yourname.github.io/drat
描述。
如果 BOLTSSIRR
更新,您 将负责更新您的存储库。这很好,因为更新可能会破坏您的更新:毕竟,它仍处于开发模式。这也很糟糕,因为您的用户不会自动获得错误修复。
就是这样,如果我没有遗漏任何东西!
我想在我的 R 包中使用 GitHub 上可用的 R 包 BOLTSSIRR
,我想将其上传到 CRAN。
我在 DESCRIPTION
文件的 Suggests:
下列出了 BOLTSSIRR
,并使用 Additional_repositories: https://github.com/daviddaigithub/BOLTSSIRR
使 link 到 GitHub 可用。
然而,运行 R CMD check --as-cran
我得到:
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
所以 GitHub link 似乎没有在检查中得到识别。我可能需要在这里更改一些内容吗?
如您所见,您不能在 CRAN 包中使用 Remotes
。您需要做的是确保您所依赖的包的 .tar.gz
文件在某处可用。 Github 不会自动执行此操作,因为 https://github.com/daviddaigithub/BOLTSSIRR
未设置为包存储库。
解决方案是创建您自己的小型存储库,并在那里保留非 CRAN 包的副本。 drat
包(可在此处获取: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。总而言之:
- 将 https://github.com/drat-base/drat 分叉到您的帐户中,并将其克隆到您自己的计算机上。
- 在主分支中启用 Github 个包含
docs/
文件夹的页面。 - 使用
remotes::install_github("eddelbuettel/drat")
将drat
包安装到 R 中。 (我假设这个版本最终会进入 CRAN;如果您使用当前的 CRAN 版本,说明会稍微复杂一些。) - 构建您要插入的包。您需要源版本;如果您的用户难以构建二进制文件,您可能也需要二进制文件。
- 运行
options(dratBranch="docs"); drat::insertPackage(...)
将这些文件插入您的存储库。 - 提交更改,并将它们推送到 Github。
- 在需要使用该非CRAN包的包中,添加
Additional_repositories: https://yourname.github.io/drat
描述。
BOLTSSIRR
更新,您 将负责更新您的存储库。这很好,因为更新可能会破坏您的更新:毕竟,它仍处于开发模式。这也很糟糕,因为您的用户不会自动获得错误修复。
就是这样,如果我没有遗漏任何东西!