How to get an rmarkdown vignette for R package to escape CRAN warnings on Solaris and OSX
I have a couple of R packages on CRAN that have warnings against Solaris (and sometimes OSX) that are related to pandoc not being available for the vignette build. For example, here are the ggseas
results on CRAN, and the source code for the vignette - slightly changed from the version submitted to CRAN but not in any relevant way.
A cursory google search suggests that this problem is common. It's also easy to find a dozen issues on GitHub for individual packages, but I can't find anything that indicates a solution. Presumably the CRAN maintainers are just letting this one past, but it's not neat if that's the case. I don't like to tick the box that says "I have resolved any notes and warnings from the last submission" when it isn't true.
Now, some lucky or skilled people have rmarkdown vignettes that don't cause this problem. For example, the tidyr vignette does not have any warnings for Solaris and OSX on CRAN. But I can't see anything different in the preamble of the tidyr vignette:
---
title: "Tidy data"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Tidy data}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
or in the DESCRIPTION file, which contains this line,
VignetteBuilder: knitr
that is different to my vignette which does spark warnings. Here is what I have:
---
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}
---
I also have knitr
and rmarkdown
in the "Suggests" of the DESCRIPTION file, which is one solution mentioned on various issues discussions (often followed by "but it doesn't fix it").
What am I missing? What is the secret to avoiding creating these warnings on CRAN? It's unfortunately not easy to experiment with this, so it would be great if we could get the definitive answer here for all the people troubled by this.
Edit / addition - the full DESCRIPTION files
Hadley Wickham suggested the problem is most likely to be in the DESCRIPTION
file of the package, rather than the vignette itself.
Here is the DESCRIPTION file of ggseas
, a package that generates the warning:
Package: ggseas
Title: 'stats' for Seasonal Adjustment on the Fly with 'ggplot2'
Version: 0.5.4
Authors@R: c(
person("Peter", "Ellis", , "[email protected]", c("aut", "cre")),
person("Christophe", "Sax", role = "ctb")
)
Maintainer: Peter Ellis <[email protected]>
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
Here is the DESCRIPTION file of tidyr, the package that doesn't generate warnings:
Package: tidyr
Title: Easily Tidy Data with 'spread()' and 'gather()' Functions
Version: 0.8.1.9000
Authors@R: c(
person("Hadley", "Wickham", , "[email protected]", c("aut", "cre")),
person("Lionel", "Henry", , "[email protected]", "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
Second edit / addition - reproducible on rhub
Here is what I see when using rhub::check(...)
for the Solaris platform. There are some clues here as to the problem being something to do with images, which fits with one suggestion on Twitter (the tidyr
vignette does not have images). As there's no point in my vignette without images (it's a graphics package) this might leave me stumped.
✔ 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
It's been a while and it seems you have not solved the problem yet.
I also have a R markdown vignette on one of my imputeTS package (vignette). It has quite a lot of images created with ggplot2, so I don't think the problem is about having images in general.
I have exactly the same annotations for the .Rmd file
MARKDOWN .Rmd file:
---
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}
---
However, my DESCRIPTION has a slight difference to yours:
DESCRIPTION
Suggests:
testthat, R.rsp, knitr, zoo, timeSeries, tis, xts, tibble, tsibble, rmarkdown
License: GPL-3
VignetteBuilder: R.rsp, knitr, rmarkdown
As you can see rmarkdown is also additionally added as VignetteBuilder. Would you midn trying this out. Some Github Issues also suggest this could be related to problems (https://github.com/r-lib/usethis/issues/1147)