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

我的未来我决定 提交于 2019-12-06 16:13:33

The current preferred solution (at least as used by ggplot2) is to store the images in man/figures/. So in the README.Rmd file, include something like the following setup chunk.

```{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)
```

That keeps the images tucked away in a place that won't generate cran check errors, but they are still part of the package. So you don't have to store them elsewhere or use calls to png::readPNG.

There are a few options. Update: I think Rob Hyndman's solution is now better than the things I list here.

  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.

I followed http://r-pkgs.had.co.nz/release.html. same error when putting them in top level and add to .Rbuildignore.

As Richie suggested, after adding images to inst/image, and refer to as ![](inst/image/README-unnamed-chunk-1-1.png)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!