R CMD 检查:异常检查已安装的包大小注释

R CMD Check: Unusual Checking installed package size note

我对包开发还很陌生,我即将开始向 CRAN 提交包的过程。我一直在努力减少 0 个错误、0 个警告和 0 个注释。还剩下 1 个我无法更正的注释(看起来好像它可能是支票的问题?)。

当运行检查时我得到了注释:

* 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

但是,当我导航到安装包的位置时,none 这些打印尺寸与 Windows Explorer 显示的相匹配。整个package文件夹只有84KB,Meta文件夹:2KB,R文件夹:58KB,help文件夹:19KB,html文件夹3KB.

我正在使用 R version 3.3.0 构建包。是什么导致了大包裹尺寸和 R CMD Check 和 Windows 之间的差异?

检查时进口会影响尺码吗? (Imports: dplyr, tidyr, magrittr, stringr, SnowballC, igraph, proxy, tm)

该问题似乎与 R Studio "Check" 按钮的 R CMD check 版本(位于构建窗格中)有关。 运行 devtools::check() 的检查产生了 0 个错误、0 个警告和 0 个注释。这两种工具在评估软件包安装大小的方式上肯定存在一些差异。包已成功上传至CRAN

作为补充:Hadley 的 'R packages' 书说 following 关于这个主题:

R CMD check is the name of the command you run from the terminal. I don’t recommend calling it directly. Instead, run devtools::check(), or press Ctrl/Cmd + Shift + E in RStudio. In contrast to R CMD check, devtools::check():

  • Ensures that the documentation is up-to-date by running 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, e.g. artifacts like .so and .o files which accompany compiled code, you can avoid the spurious warnings such files will generate.

  • Sets the NOT_CRAN environment variable to TRUE. This allows you to selectively skip tests on CRAN. (See ?testthat::skip_on_cran for details.)

从评论来看,似乎使用 devtools::check 而不是 R CMD 检查也为其他用户解决了这个问题。

我认为 R Studio 的复选按钮默认调用 devtools::check()。 但可能是默认设置已更改 - 或者未安装 devtools 包。

当您转到 R Studio 检查按钮旁边的“更多”,然后转到“配置构建工具”时,您会得到构建设置。有一个名为“如果可用就使用 devtools 包函数”的复选框,应该选中它。