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

三世轮回 提交于 2019-12-22 01:26:31

问题


I am writing a vignette for my R package. I want to include a .jpg image on the .Rmd file that will generate the pdf vignette. The question is: where should I store this image?

I am using the packages devtools and knitr to generate vignettes (following the advise from @hadley book 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)?

Thanks in advance for any suggestion. Cheers


回答1:


It's pretty clearly described in the 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.




回答2:


It is also appropriate to put them in the "man/figures" folder -- this also holds for images you may have in your README.

See comment by Hadley on github issue that happens to reference guidelines: https://github.com/r-lib/pkgdown/issues/280#issue-213905707




回答3:


I'm thinking that jpgs would fall under Hadley's advice 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.



来源:https://stackoverflow.com/questions/32287633/which-is-the-correct-folder-to-store-images-used-in-vignettes-for-r-packages

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