两个 R 包可以在彼此的依赖列表中吗?

发布于 2025-01-03 07:18:11 字数 575 浏览 1 评论 0原文

假设我有 3 个包 ABC

B 连接到数据存储库 1 并具有特定于该 API 的功能。

C 连接到数据存储库 2 并具有特定于该 API 的函数。

最终还会有更多的子包。

A将具有通用方法和其他通用功能(例如身份验证),适用于通过BC获取的数据>。这里的理由是,这将是一种更简化的方式来跟上开发(例如,必须更新单个 auth 函数,而不是在每个子包中执行此操作)。因此,A 位于 BC 的依赖列表中是有意义的

,但我也希望用户只安装 A 并有权访问所有子包。为此,我希望 BC 位于其依赖列表中。

这可能吗?我应该有更好的工作流程吗?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

扎心 2025-01-10 07:18:12

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

北恋 2025-01-10 07:18:12

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文