R包小插图:无小插图索引警告

时间:2018-08-10 18:42:50

标签: r

我有一个名为index.html的新R包,其中包含有关如何将LaTeX和Markdown文档与自定义模板一起使用的信息。

当我在Ubuntu Linux上构建软件包时,后续检查通常是成功的,但是我对您在下面看到的小插图索引警告感到困惑。实际上,我确实有一个小插图$ R CMD check --as-cran stationery_0.92.tar.gz * using log directory ‘/tmp/stationery.Rcheck’ * using R version 3.5.1 (2018-07-02) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: UTF-8 * using option ‘--as-cran’ * checking for file ‘stationery/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘stationery’ version ‘0.92’ * checking CRAN incoming feasibility ... NOTE Maintainer: ‘Paul Johnson <pauljohn@ku.edu>’ New submission Package has a VignetteBuilder field but no prebuilt vignette index. * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking serialization versions ... OK * checking whether package ‘stationery’ can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking sizes of PDF files under ‘inst/doc’ ... OK * checking installed files from ‘inst/doc’ ... OK * checking files in ‘vignettes’ ... OK * checking examples ... OK ** found \donttest examples: check also with --run-donttest * checking for unstated dependencies in vignettes ... OK * checking package vignettes in ‘inst/doc’ ... OK * checking re-building of vignette outputs ... OK * checking PDF version of manual ... OK * DONE Status: 1 NOTE See ‘/tmp/stationery.Rcheck/00check.log’ for details. 文件:

index.html

我不明白“包装中有VignetteBuilder字段,但没有预建的小插图索引”的警告。我确实在源目录的vignettes文件夹中以及编译后的程序包中有一个名为$ ls stationery/inst/doc/ code_chunks.pdf HTML_special_features.html index.html Rmarkdown.pdf stationery.pdf 的文件,它显示在inst / doc下:

$ ls stationery.Rcheck/stationery/doc/
code_chunks.pdf             HTML_special_features.Rmd  Rmarkdown.Rmd   
stationery.Rnw
code_chunks.Rmd             index.html                 stationery.pdf
HTML_special_features.html  Rmarkdown.pdf              stationery.R

当R check --as-cran运行时,它将创建一个文件夹“ stationery.Rcheck”,并且index.html也存在:

R CMD build

我安装了软件包,索引工作正常。它正确列出了所有四个小插图。

现在,我是怎么开始的?在构建软件包之前,将对这些小插图进行提前编译和压缩。似乎$ R CMD build stationery 不想让我再次构建它们:

* creating vignettes ... OK
Warning: ‘inst/doc’ files
    ‘HTML_special_features.html’, ‘Rmarkdown.pdf’, ‘code_chunks.pdf’,  ‘stationery.pdf’
  ignored as vignettes have been rebuilt.
  Run R CMD build with --no-build-vignettes to prevent rebuilding.

成功显示以下消息

--no-build-vignettes

我认为这是个好主意。

现在看来,如果我使用index.html,则会忽略我提供的小插图索引文件。

您想知道index.html是哪里来的?我构建了软件包并研究了输出tar.gz文件。它为我创建了index.html。我将其手动复制到vignettes文件夹中。

我是否错过了某个步骤,以便包裹检查器知道Tag="{Binding DataContext, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type StackPanel}, AncestorLevel=2}}"

2 个答案:

答案 0 :(得分:2)

我有95%的把握是正确的答案。我在R软件包开发列表中要求找出答案。

尽管index.html文件在文档(https://datascience.stackexchange.com/questions/25924/difference-between-interpolate-and-fillna-in-pandas?rq=1)中被描述为关键元素,但实际上使警告静音所需的文件是

build/vignette.rds

我在R源代码src/library/tools/R/QC.R中发现了这一点。在其中找到函数“ .check_package_CRAN_incoming”,该函数向我发出有关缺少预构建的装饰图案索引的警告。与其像我期望的那样检查index.html,不如说它会寻找“ build / vignette.rds”。

vds <- character()
    if(!is.na(meta["VignetteBuilder"])) {
        if(!file.exists(vds <- file.path(dir, "build", "vignette.rds")))
            out$missing_vignette_index <- TRUE
        else
            vds <- readRDS(vds)[, "File"]
    }

此后,如果没有vignette.rds文件,则会发出警告:

if(length(y <- x$missing_vignette_index)) {
      "Package has a VignetteBuilder field but no prebuilt vignette index."
},

vignette.rds是一个数据框,具有从头构建index.html文件所需的内容。 vignette.rds的内容具有像这样的列:

文件标题PDF R取决于关键字

如果未使用“ no-build-vignettes”调用R CMD构建,则会自动创建vignette.rds。

在使用vignette.rds文件将打包文件夹插入我的软件包源中之后,来自“ R CMD check --as-cran”的警告被静音。

我对devtools软件包进行了检查,因为这是一些电子邮件所建议的。它只是格式化命令行语句以伴随R CMD构建,它并没有为我们做任何额外的工作。 devtools::build只需构建一个命令行:

/usr/lib/R/bin/R --no-site-file --no-environ --no-save --no-restore --quiet  \
CMD build 'stationery.gitex'  --no-resave-data --no-manual

如果我允许构建小插图,则插入--compact-vignettes='both',而当我不想创建小插图时,则插入--no-build-vignettes

答案 1 :(得分:0)

正如@ pauljohn32所说,R CMD build构建build/vignette.rds,因此,此注释的常见原因是.Rbuildignore中的一行导致任何此类文件从构建中排除-为例如^.*.rds$。如果.Rbuildignore中有类似的行,则应将其删除。