两个 R 包可以在彼此的依赖列表中吗?
假设我有 3 个包 A
、B
和 C
。
B
连接到数据存储库 1
并具有特定于该 API 的功能。
C
连接到数据存储库 2
并具有特定于该 API 的函数。
最终还会有更多的子包。
包A
将具有通用
方法和其他通用功能(例如身份验证),适用于通过B
和C
获取的数据>。这里的理由是,这将是一种更简化的方式来跟上开发(例如,必须更新单个 auth
函数,而不是在每个子包中执行此操作)。因此,A
位于 B
和 C
的依赖列表中是有意义的
,但我也希望用户只安装 A
并有权访问所有子包。为此,我希望 B
和 C
位于其依赖列表中。
这可能吗?我应该有更好的工作流程吗?
Let's say I have 3 packages A
, B
, and C
.
B
connects to data repository 1
and has functions specific to that API.
C
connects to data repository 2
and has functions specific to that API.
Eventually there will be several more child packages.
Package A
will have generic
methods and other common functions (e.g. authentication) that apply to data acquired through B
and C
. The rationale here is that this would be a more streamlined way to keep up with development (e.g. one would have to update a single auth
function rather than doing that inside each child package). So it makes sense for A
to be on the depends list for B
and C
But I would also like users to just install A
and have access to all child packages. For this, I want B
and C
to be on its depends list.
Is this possible? Should I have a better workflow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
gregmisc
包就是这样一个示例,它通过 dependents 安装更集中的子包。它本身没有任何功能,但它肯定可以。http://cran.r-project.org/web/packages/gregmisc
The
gregmisc
package is one example like this that installs more focused sub-packages through depends. It doesn't have any functionality, itself, but it certainly could.http://cran.r-project.org/web/packages/gregmisc
2021 年更新:这不再可能了。 R RMD 检查将抱怨并返回错误 - 包不能相互依赖。
之前的答案中提到的 gregmisc 包已从 CRAN 中删除(可能是因为这个原因)。
Updated in 2021: this is not possible anymore. R RMD Check will complain and return an error - packages cannot depend on each other.
The
gregmisc
package mentioned in a previous answer was removed from CRAN (probably because of this reason).