简体   繁体   English

R CMD Check: Unusual Checking install package size note

[英]R CMD Check: Unusual Checking installed package size note

I'm fairly new to package development and I am about to start the process of submitting a package to CRAN.我对包开发还很陌生,我即将开始向 CRAN 提交包的过程。 I've been striving to get down to 0 errors, 0 warnings, & 0 notes.我一直在努力减少 0 个错误、0 个警告和 0 个注释。 There is 1 note left that I have not been able to correct (and appears as if it might be an issue with the check?).还剩下 1 个我无法更正的注释(看起来好像它可能是支票的问题?)。

When running the check I get the note:运行检查时,我收到以下注释:

* checking installed package size ... NOTE
  installed size is 19.0Mb
  sub-directories of 1Mb or more:
    Meta   5.0Mb
    R      3.0Mb
    help   5.0Mb
    html   2.0Mb

However, when I navigate to the where the package is installed, none of these printed sizes match up with what Windows Explorer shows.但是,当我导航到安装包的位置时,这些打印尺寸都与 Windows 资源管理器显示的尺寸不匹配。 The entire package folder is only 84KB, the Meta folder: 2KB, the R folder: 58KB, the help folder: 19KB, and the html folder 3KB.整个package文件夹只有84KB,Meta文件夹:2KB,R文件夹:58KB,help文件夹:19KB,html文件夹3KB。

I am building the package using R version 3.3.0 .我正在使用R version 3.3.0构建包。 What could be causing both the large package size and the discrepancy between R CMD Check and Windows?什么可能导致大包大小和R CMD Check和 Windows 之间的差异?

Do imports affect the size during the check?进口会影响检查时的尺寸吗? ( Imports: dplyr, tidyr, magrittr, stringr, SnowballC, igraph, proxy, tm ) Imports: dplyr, tidyr, magrittr, stringr, SnowballC, igraph, proxy, tm

The issue appears to be related to the R Studio "Check" button's version of the R CMD check (located on the Build pane).该问题似乎与 R Studio“检查”按钮的R CMD check版本(位于“构建”窗格中)有关。 Running the check with devtools::check() produced 0 errors, 0 warnings, & 0 notes.使用devtools::check()运行检查产生 0 个错误、0 个警告和 0 个注释。 There must be some difference in how the two tools assess a package's installed size.这两个工具评估软件包安装大小的方式肯定存在一些差异。 The package has now been successfully uploaded to CRAN.该包现已成功上传到 CRAN。

As an addition: Hadley's 'R packages' book says the following about this topic:作为补充:Hadley 的“R 包”一书对这个主题做了以下说明:

R CMD check is the name of the command you run from the terminal. R CMD check 是您从终端运行的命令的名称。 I don't recommend calling it directly.我不建议直接调用它。 Instead, run devtools::check(), or press Ctrl/Cmd + Shift + E in RStudio.相反,运行 devtools::check(),或在 RStudio 中按 Ctrl/Cmd + Shift + E。 In contrast to R CMD check, devtools::check():与 R CMD 检查相反,devtools::check():

  • Ensures that the documentation is up-to-date by running devtools::document().通过运行 devtools::document() 确保文档是最新的。

  • Bundles the package before checking it.在检查之前捆绑包裹。 This is the best practice for checking packages because it makes sure the check starts with a clean slate: because a package bundle doesn't contain any of the temporary files that can accumulate in your source package, eg artifacts like .so and .o files which accompany compiled code, you can avoid the spurious warnings such files will generate.这是检查包的最佳实践,因为它确保检查从一个干净的石板开始:因为包包不包含任何可以在源包中积累的临时文件,例如像 .so 和 .o 文件这样的工件伴随编译的代码,您可以避免此类文件将生成的虚假警告。

  • Sets the NOT_CRAN environment variable to TRUE.将 NOT_CRAN 环境变量设置为 TRUE。 This allows you to selectively skip tests on CRAN.这允许您有选择地跳过 CRAN 上的测试。 (See ?testthat::skip_on_cran for details.) (有关详细信息,请参阅 ?testthat::skip_on_cran。)

Judging from the comments it seems using devtools::check instead of R CMD check solved this problem also for other users.从评论来看,似乎使用 devtools::check 而不是 R CMD check 也为其他用户解决了这个问题。

I think the check button of R Studio calls devtools::check() already as a default.我认为 R Studio 的检查按钮已经默认调用 devtools::check() 。 But it could be that the default settings were changed - or the devtools package was not installed.但可能是默认设置已更改 - 或者未安装 devtools 包。

When you go next to the R Studio check button to ' more ' and then to ' configure build tools ' you get to the build settings.当您在 R Studio 检查按钮旁边找到“更多”,然后转到“配置构建工具”时,您将进入构建设置。 There is a checkbox called ' use devtools package functions if available ' which should be checked.有一个名为“如果可用时使用 devtools 包函数”的复选框,应选中它。

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

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