如何使R包推荐在GitHub上托管的包? [英] How to make R package recommend a package hosted on GitHub?

查看:99
本文介绍了如何使R包推荐在GitHub上托管的包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个R包,该包可以用作并行包和Rhpc包中的函数的包装,称为工具。我知道,如果我想让我的软件包要求这些软件包,我需要将它们包含在 DESCRIPTION 导入部分中文件。在安装我的软件包时,这些软件包将从CRAN安装。同样,如果不是必需的,也可以将它们放在 Suggests 部分中。这些将不会随我的软件包一起安装。

I'm developing an R package that works as a wrapper for functions from the parallel and Rhpc packages called ctools. I know that if I want my package to require these packages I need to include them in the Imports section of the DESCRIPTION file. When installing my package, these packages will be installed from CRAN. Similarly I can put them in the Suggests section if they aren't required, but useful. These won't be installed with my package.

但是,我分叉了Rhpc软件包,并在ctools软件包中添加了一个功能。我如何从我的GitHub存储库中获取建议/导入该软件包的软件包,而不是安装Rhpc软件包,而是执行 devtools :: install_github( bamonroe / Rhpc)

But, I've forked the Rhpc package and added a function that I use in my ctools package. How do I get my package to Suggest/Import this package from my GitHub repo so of instead of installing the Rhpc package, it executes devtools::install_github("bamonroe/Rhpc")?

推荐答案

从手册(并在此处引用源)中:

From the manual (and quoting source here):

@c描述字段Additional_repositories

@c DESCRIPTION field Additional_repositories

@samp {Additional_repositories}字段是逗号分隔的
存储库URL列表,其中在其他字段中命名的软件包可能是
。 @command {R CMD check}当前使用它来检查
软件包是否可以找到,至少作为源软件包(可以在任何平台上安装的
)。

The @samp{Additional_repositories} field is a comma-separated list of repository URLs where the packages named in the other fields may be found. It is currently used by @command{R CMD check} to check that the packages can be found, at least as source packages (which can be installed on any platform).

您可以将软件包添加到建议:并指向其他存储库-可能使用 drat 。曾经有一个软件包可以这样做,而IIRC现在有另一个软件包可以使用,但是它的名字现在让我无所适从。

You can add the package to Suggests: and point to additional repositories -- possibly created using drat. There used to a package doing that, and IIRC there is another one doing it now but its name escaped me now.

Edit:找到了!参见 RNeXML的源描述文件 –和请注意在CRAN上发布的说明中该行的消失方式。更好的是,请注意建议中的两个软件包是如何 not 在CRAN上列出的超链接。我认为这些来自额外的回购协议。是的,rOpenSci使用 drat 进行管理。

Found it! See here in the source DESCRIPTION file of RNeXML -- and note how the line disappears in the posted DESCRIPTION on CRAN. Better still, note how two of the packages in Suggests: are not listed a hyperlinks on CRAN. I thinks those come from the additional repos. And yes, rOpenSci uses drat to manage that.

编辑2:只是为了结束循环,您(轻松地)使用 drat 以便在GitHub上托管这样的附加仓库- drat

Edit 2: And just to close the loop, you (easily) use drat to host such an additional repo on GitHub -- the prime use case for drat.

编辑3: RNeXML删除了其他存储库,但 github历史仍然存在。

Edit 3: RNeXML has dropped the additional repository, but the github history still has it.

编辑4:当前(即2020年3月13日),CRAN打包了EMC,bcmaps,blkbox,broom.mixed,epikit ,grattan,gtsummary,飓风暴露,备忘录,多项式,noaastormevents,pointblank,provSummarize,provViz,spData,swephR,tashu,taxadb,waveformbildar全部列出了包含URL指向的字段 Additional_repositories drat 回购。

Edit 4: Currently (i.e. on 2020-03-13), the CRAN packages EMC, bcmaps, blkbox, broom.mixed, epikit, grattan, gtsummary, hurricaneexposure, memoise, multinomialeq, noaastormevents, pointblank, provSummarize, provViz, spData, swephR, tashu, taxadb, waveformbildar all list a field Additional_repositories containing a URL pointing to a drat repo.

这篇关于如何使R包推荐在GitHub上托管的包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆