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

Jenny Bryan jenny at stat.ubc.ca
Mon May 22 07:56:14 CEST 2017


Hi Sebastian,

Many packages on CRAN have the problem yours exhibits and, as they update, will also need to address it. In mid-March Kurt Hornik emailed the associated maintainers to notify them that their package's README.html uses images that do not ship with the package.

Here's the most important passage from that email re: how to remedy:

> If the images are also used for vignettes or Rd files, you can put them
> in the 'vignettes' or 'man/figures' directories.  Otherwise, please put
> them in the top-level 'tools' directory, or a subdirectory of it.

So you'll need to change the fig.path in the setup chunk. There's already an issue in devtools to change its default (https://github.com/hadley/devtools/issues/1477).

-- Jenny

> On May 21, 2017, at 6:48 PM, Sebastian Kopf <Sebastian.Kopf at colorado.edu> wrote:
> 
> 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.
> `fig.path=‘README-‘`)
> 
> - 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
> win_builder.
> 
> 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,
> Sebastian
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list