简体   繁体   English

R CMD检查的软件包依赖关系

[英]Package dependencies for R CMD check

The DESCRIPTION file in R packages has several ways of specifying dependencies, eg Depends , Suggests and Imports . R包中的DESCRIPTION文件有几种指定依赖项的方式,例如DependsSuggestsImports Which one should I use to specify a dependency that is optional once the package is installed, but required for running R CMD check ? 安装软件包后,我应该使用哪一个来指定可选的依赖关系,但是运行R CMD check

In my particular case I am using testthat to run some tests automatically when R CMD check is run, but during "normal" operation, testthat is not required. 在我的特殊情况下,我使用testthat在运行R CMD check时自动运行一些测试,但是在“正常”操作期间, testthat The answer to this question suggests that testthat should be in Suggests , but is that enough to ensure that R CMD check runs correctly? 在回答这个问题的建议, testthat应该是Suggests ,但是否足够,以确保R CMD check正常运行?

What I would like to see, if it exists, is a field where I can speciy dependencies that are required only to run R CMD check , which should fail with an appropriate error message if these packages are not available. 我想看到的是(如果存在)一个字段,我可以在该字段中指定运行R CMD check所需的依赖项,如果这些软件包不可用,它将失败并显示相应的错误消息。

Yes, you should put them in the Suggests field. 是的,您应该将它们放在“ Suggests字段中。 The only other thing required for R CMD check to run successfully is to ensure the packages in the Suggests field are installed in a location that will be found by R CMD check . 要成功运行R CMD check ,唯一需要做的另一件事是确保“ Suggests字段中的软件包安装在R CMD check可以找到的位置。

If they're not available, you can set the environment variable _R_CHECK_FORCE_SUGGESTS=false and R CMD check will run, with a "NOTE" about the missing suggested packages. 如果它们不可用,则可以设置环境变量_R_CHECK_FORCE_SUGGESTS=false然后R CMD check将运行,并带有“ NOTE”(注释)有关缺少的建议软件包的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM