如何获得R包的rmarkdown插图以逃避Solaris和OSX上的CRAN警告

Pet*_*lis 15 r cran knitr r-markdown

我在CRAN上有几个R包,它们针对与pandoc无关的Solaris(有时是OSX)警告不能用于插件构建.例如,以下是ggseasCRAN上的结果,以及插图源代码 - 从提交给CRAN的版本略有变化,但没有以任何相关方式.

粗略的谷歌搜索表明这个问题很常见.在GitHub上为单个包找到十几个问题也很容易,但我找不到任何表明解决方案的问题.据推测,CRAN维护者只是让这一个过去了,但如果是这样的话,它并不是很整洁.我不喜欢勾选出"我已经解决了上次提交的任何注释和警告"的方框,但这不是真的.

现在,一些幸运或技术熟练的人有不会引起这个问题的rmarkdown小插曲.例如,tidyr小插曲没有对Solaris和OSX上CRAN任何警告.但是我在tidyr小插曲的序言中看不出任何不同之处:

---
title: "Tidy data"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Tidy data}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---
Run Code Online (Sandbox Code Playgroud)

或者在包含此行的DESCRIPTION文件中,

VignetteBuilder: knitr
Run Code Online (Sandbox Code Playgroud)

这与我的小插图不同,它确实引发了警告.这是我有的:

---
title: "ggseas - seasonal decomposition on the fly"
author: "Peter Ellis"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{ggseas - seasonal decomposition on the fly}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---
Run Code Online (Sandbox Code Playgroud)

我也有knitrrmarkdown在DESCRIPTION文件的"建议"中,这是在各种问题讨论中提到的一个解决方案(通常后跟"但它没有解决它").

我错过了什么?避免在CRAN上创建这些警告的秘诀是什么?不幸的是,这并不容易进行实验,所以如果我们能够为所有受此困扰的人们获得明确的答案,那将会很棒.

编辑/添加 - 完整的描述文件

Hadley Wickham认为问题最有可能出现在DESCRIPTION包的文件中,而不是插图本身.

这是ggseas一个包含生成警告的包的DESCRIPTION文件:

Package: ggseas
Title: 'stats' for Seasonal Adjustment on the Fly with 'ggplot2'
Version: 0.5.4
Authors@R: c(
   person("Peter", "Ellis", , "peter.ellis2013nz@gmail.com", c("aut", "cre")),
   person("Christophe", "Sax", role = "ctb")
   )
Maintainer: Peter Ellis <peter.ellis2013nz@gmail.com>
Description: Provides 'ggplot2' 'stats' that estimate seasonally adjusted series 
    and rolling summaries such as rolling average on the fly for time series.
Depends:
    R (>= 3.1.2), 
    ggplot2 (>= 2.0.0)
Imports:
    seasonal, 
    rlang,
    stats,
    zoo
License: GPL-3
LazyData: true
RoxygenNote: 6.0.1
BugReports: https://github.com/ellisp/ggseas/issues
Suggests: testthat,
    knitr,
    rmarkdown
VignetteBuilder: knitr
Run Code Online (Sandbox Code Playgroud)

这是tidyr的DESCRIPTION文件,该包不会生成警告:

Package: tidyr
Title: Easily Tidy Data with 'spread()' and 'gather()' Functions
Version: 0.8.1.9000
Authors@R: c(
    person("Hadley", "Wickham", , "hadley@rstudio.com", c("aut", "cre")),
    person("Lionel", "Henry", , "lionel@rstudio.com", "aut"),
    person("RStudio", role = "cph")
    )
Description: An evolution of 'reshape2'. It's designed specifically for data
    tidying (not general reshaping or aggregating) and works well with
    'dplyr' data pipelines.
License: MIT + file LICENSE
URL: http://tidyr.tidyverse.org,
    https://github.com/tidyverse/tidyr
BugReports: https://github.com/tidyverse/tidyr/issues
Depends: 
    R (>= 3.1)
Imports: 
    dplyr (>= 0.7.0),
    glue,
    magrittr,
    purrr,
    Rcpp,
    rlang,
    stringi,
    tibble,
    tidyselect
Suggests: 
    covr,
    gapminder,
    knitr,
    rmarkdown,
    testthat
LinkingTo: 
    Rcpp
VignetteBuilder: knitr
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.0.1
Run Code Online (Sandbox Code Playgroud)

第二次编辑/添加 - 可重现 rhub

以下是我在使用rhub::check(...)Solaris平台时看到的内容.这里有一些关于问题与图像有关的线索,这符合Twitter上的一个建议(tidyr晕图没有图像).由于我的小插图没有图像(这是一个图形包)没有任何意义,这可能让我感到难过.

?  checking package vignettes in ‘inst/doc’
?  checking running R code from vignettes ...
      ‘ggseas.Rmd’ using ‘UTF-8’ ... OK
    NONE
W  checking re-building of vignette outputs
   Error in re-building vignettes:
     ...
   Warning in engine$weave(file, quiet = quiet, encoding = enc) :
     Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to R Markdown v1.
   Warning in (function (filename = "Rplot%03d.png", width = 480, height = 480,  :
     unable to open connection to X11 display ''
   Quitting from lines 47-49 (ggseas.Rmd) 
   Error: processing vignette 'ggseas.Rmd' failed with diagnostics:
   unable to start device PNG
   Execution halted
Run Code Online (Sandbox Code Playgroud)

sta*_*007 1

已经有一段时间了,看来你的问题还没有解决。

我的一个 imputeTS 包 ( vignette )上还有一个 R markdown vignette 。它有很多用 ggplot2 创建的图像,所以我认为问题不在于一般的图像。

我对 .Rmd 文件有完全相同的注释

MARKDOWN .Rmd 文件:

---
title: "Gallery: Times Series Missing Data Visualizations"
author: "Steffen Moritz"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Gallery: Times Series Missing Data Visualizations}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
--- 
Run Code Online (Sandbox Code Playgroud)

然而,我的描述与你的略有不同:

描述

Suggests:
    testthat,  R.rsp, knitr, zoo, timeSeries, tis, xts, tibble, tsibble, rmarkdown
License: GPL-3
VignetteBuilder: R.rsp, knitr, rmarkdown
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,rmarkdown 也被额外添加为 VignetteBuilder。你愿意尝试一下吗?一些 Github 问题还表明这可能与问题有关(https://github.com/r-lib/usethis/issues/1147