哪个文件夹是用于存储 R 包小插图中使用的图像的正确文件夹?

Which is the correct folder to store images used in vignettes for R packages ?

我正在为我的 R 包写一个小插图。我想在将生成 pdf 小插图的 .Rmd 文件中包含一个 .jpg 图像。问题是:我应该在哪里存储这个图像?

我正在使用包 devtoolsknitr 来生成插图(遵循@hadley 书 link). Therefore, I have the folder vignettes in my package structure. Should I just include the file there? Or should I include the image on a new folder inside 'inst/images', as suggested for external data used in vignettes (also recomended by @hadley: link 的建议)?

提前感谢您的任何建议。 干杯

我认为 jpgs 会接受 Hadley 的建议here

If you want to store binary data and make it available to the user, put it in data/. This is the best place to put example datasets.

Writing R Extensions manual中描述的很清楚:

All other files needed to re-make the vignettes (such as LaTeX style files, BibTeX input files and files for any figures not created by running the code in the vignette) must be in the vignette source directory.

将它们放在 "man/figures" 文件夹中也是合适的——这也适用于您的 README 中可能包含的图像。

请参阅 Hadley 对 github 恰好参考指南的问题的评论:https://github.com/r-lib/pkgdown/issues/280#issue-213905707