effel effel -4 years ago 66
R Question

NOTE or WARNING from package check when README.md includes images

I have a package with a

that I pass to

and a directory
, which contains images in
. This looks like the tree below.

is not a standard package directory, so if it isn't in
, checking the package with
R CMD check
shows a note:

* checking top-level files ...
NOTE Non-standard file/directory found at top level: README_files

But including the directory in
leads to a warning, if and only if checking the package
. IIUC Pandoc tries to generate HTML from
, but the images are unavailable, in the ignored

Conversion of ‘README.md’ failed:
pandoc: Could not fetch README_files/unnamed-chunk-14-1.png
README_files/unnamed-chunk-14-1.png: openBinaryFile: does not exist (No such file or directory)

Is there any way to get a clean check

├── README_files
│   └── figure-markdown_github
│   ├── unnamed-chunk-14-1.png
│   ├── unnamed-chunk-15-1.png
│   ├── unnamed-chunk-16-1.png
│   ├── unnamed-chunk-26-1.png
│   └── unnamed-chunk-27-1.png
├── README.md
├── README.Rmd

Answer Source

There are a few options.

  1. Store the image online somewhere, and include the URL in the README.
  2. As @Axeman noted, you can follow the ggplot2 approach of storing the images at the top level, and mentioning them in .Rbuildignore.
  3. You can store them in inst/image, and use png::readPNG(system.file("image/yourpic.png", package = "yourpkg")) to read it. Then show it in the README using a plot.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download