如何告诉CRAN自动安装包依赖项?

2023-12-30

我在 R 中开发了一个包,当我在本地计算机中检查并构建它时,它可以正常工作。但是当我在 CRAN 中尝试时,出现包依赖错误。我的包依赖于其他包的两个功能。

如果我在下面列出其他包description using Depends or imports,会自动随新包一起安装吗?或者我需要显式调用该函数install.packages("packagename")在我使用其他包的功能下。如果这一切都是错误的,那么解决包依赖关系的最佳方法是什么R为了通过R CMD check and build测试并提交给CRAN?

谢谢。


在您自己的系统上尝试

install.packages("foo", dependencies=...)

dependencies=参数被记录为

dependencies: logical indicating to also install uninstalled packages
      which these packages depend on/link to/import/suggest (and so
      on recursively).  Not used if ‘repos = NULL’.  Can also be a
      character vector, a subset of ‘c("Depends", "Imports",
      "LinkingTo", "Suggests", "Enhances")’.

      Only supported if ‘lib’ is of length one (or missing), so it
      is unambiguous where to install the dependent packages.  If
      this is not the case it is ignored, with a warning.

      The default, ‘NA’, means ‘c("Depends", "Imports",
      "LinkingTo")’.

      ‘TRUE’ means (as from R 2.15.0) to use ‘c("Depends",
      "Imports", "LinkingTo", "Suggests")’ for ‘pkgs’ and
      ‘c("Depends", "Imports", "LinkingTo")’ for added
      dependencies: this installs all the packages needed to run
      ‘pkgs’, their examples, tests and vignettes (if the package
      author specified them correctly).

所以你可能想要一个值TRUE.

在您的包裹中,列出需要的物品Depends:,参见编写 R 扩展 http://cran.r-project.org/doc/manuals/r-release/R-exts.html手册对此非常清楚。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何告诉CRAN自动安装包依赖项? 的相关文章

随机推荐