如何告诉CRAN自动安装包依赖关系?
我在R中开发一个包,当我检查并在我的本地计算机中构build它时,它工作正常。 但是,当我在CRAN中尝试它,我得到一个包依赖性错误。 我的软件包取决于其他软件包的两个function。
如果我使用“ Depends
或“ imports
在description
下列出了其他软件包,是否将自动安装新软件包? 或者我需要在我使用其他包的函数下显式地调用函数install.packages("packagename")
。 如果这一切都是错误的,那么解决R
包依赖关系的最好方法是通过R CMD check
并build
testing并提交给CRAN?
谢谢。
在你自己的系统上,试试
install.packages("foo", dependencies=...)
与dependencies=
参数logging为
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:
需要的内容Depends:
,请参阅写入R扩展手册,这个手册非常清楚。
另一种可能性是select“安装依赖关系”checkbox在右下angular的R软件包安装程序中: