【发布时间】:2018-11-20 04:42:25
【问题描述】:
我在 CRAN 上有几个 R 包,它们对 Solaris(有时是 OSX)发出警告,这些警告与 pandoc 无法用于小插图构建有关。例如,这里是 ggseas results on CRAN 和 source code for the vignette - 与提交给 CRAN 的版本略有不同,但没有任何相关的方式。
粗略的谷歌搜索表明这个问题很常见。也很容易在 GitHub 上为单个包找到十几个问题,但我找不到任何表明解决方案的东西。据推测,CRAN 维护人员只是让这个过去,但如果是这样的话,那就不整洁了。我不喜欢勾选“我已经解决了上次提交的任何注释和警告”的方框。
现在,一些幸运或技术娴熟的人拥有不会导致此问题的 rmarkdown 小插曲。例如,tidyr vignette 执行 not have any warnings for Solaris and OSX on CRAN。但我在 tidyr 小插图的序言中看不出有什么不同:
---
title: "Tidy data"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Tidy data}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
或者在包含这一行的DESCRIPTION文件中,
VignetteBuilder: knitr
这与我的引发警告的小插图不同。这是我所拥有的:
---
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}
---
我在DESCRIPTION文件的“建议”中也有knitr和rmarkdown,这是在各种问题讨论中提到的一种解决方案(通常后跟“但它不能解决它”)。
我错过了什么?避免在 CRAN 上创建这些警告的秘诀是什么?不幸的是,尝试这个并不容易,所以如果我们能在这里为所有受此困扰的人提供明确的答案,那就太好了。
编辑/添加 - 完整的说明文件
Hadley Wickham 认为问题很可能出在包的 DESCRIPTION 文件中,而不是小插图本身。
这是ggseas的说明文件,这是一个产生警告的包:
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
这里是tidyr的描述文件,不会产生警告的包:
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
第二次编辑/添加 - 可在 rhub 上重现
这是我在 Solaris 平台上使用 rhub::check(...) 时看到的内容。这里有一些线索表明问题与图像有关,这与one suggestion on 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
【问题讨论】:
-
首先我意识到大黄的存在;多么棒的工具啊。我会告诉你我的进展情况(到目前为止,我已经花了 10 分钟等待我的电子邮件验证令牌,但我确定这是一个暂时的问题)。
-
@RalfStubner 是的,我可以在大黄上重现。 rhub 错误信息已添加到问题中。
-
对于它的价值,sitmo 有一个 Rmd 小插图,包括一个似乎可以在 CRAN 上构建的 ggplot2 图像。
-
消息说 pandoc 不可用。也许它在某些测试机器上,但不是在其他机器上。它不是一个易于构建的软件包,而且它的网站不提供 Solaris 的构建。当我遇到这样的情况(即出于正当理由不处理一些较旧的检查消息)时,我只是在提交消息中进行说明。
-
您可以将整个文档或有问题的块 eval 设置为
eval=rmarkdown::pandoc_available(pandoc_version)这将检查系统上正在运行的版本,如果不是至少则跳过。
标签: r r-markdown knitr cran