[R-pkg-devel] What is the proper way to include README.Rmd generated png’s for package submission to CRAN?

Sebastian Kopf Sebastian.Kopf at colorado.edu
Mon May 22 03:48:53 CEST 2017

Hi all,

I’m stuck trying to figure out the appropriate way to include figures
generated by a README.Rmd for package submission to CRAN. Any advice much
appreciated. Here is the problem:

 - I generated an RMarkdown package README using
`devtools::use_readme_rmd()`, leaving the chunk options intact (i.e.

 - I included basic instructions and links to the vignettes but would also
like to include an example figure so I added a chunk in the README.Rmd that
generates and correctly saves the resulting figure in README-example-1.png

 - The package passes `devtools::check(cran = TRUE)` without errors,
warnings or notes but generates a warning on win-builder because of the
figure with the following message:

*Conversion of 'README.md' failed:pandoc.exe: Could not fetch
README-example-1.pngREADME-example-1.png: openBinaryFile: does not exist
(No such file or directory) *

I understand that this is correct behavior because the file is of course
explicitly excluded from the build (`^README-.*\.png$` in .Rbuildignore),
and without this line in .Rbuildignore I would get a different warning that
this png should indeed not be part of the build.

What I could not figure out is how I should proceed with this so it passes

I checked how this is done in the ggplot2 GitHub repository (which also
includes a figure in its README.md that is generated by a README.Rmd) and
made sure my .Rbuildignore and other settings are all correct. I eventually
realized that the README.html generated on CRAN for ggplot2 actually does
not have the png included either (
https://cran.r-project.org/web/packages/ggplot2/README.html) so perhaps
this is just not possible and I need to communicate to win_builder that it
will indeed be missing this png in some way? Or perhaps I should just avoid
having an example figure in the README altogether?

Any help much appreciated, I apologize if this turns out to be a trivial
question and there is some different way I should be generating the README
for submission to CRAN.

Best regards,

	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list