Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 650
Gustavo B Paterno Avatar asked Aug 29 '15 15:08

Gustavo B Paterno


People also ask

How do you make a package vignette in R?

To create a package vignette in R Markdown, the easiest way is through the RStudio menu File -> New File -> R Markdown -> From Template (see Figure 16.4). Then you select “Package Vignette” from the rmarkdown package, and you will get a vignette template.

What is vignette in R package?

Function documentation is great if you know the name of the function you need, but it's useless otherwise. A vignette is like a book chapter or an academic paper: it can describe the problem that your package is designed to solve, and then show the reader how to solve it.

How do you find R vignettes?

Currently, only PDF versions of vignettes can be viewed. The program specified by the pdfviewer option is used for this. If several vignettes have PDF versions with base name identical to topic , the first one found is used. If no topics are given, all available vignettes are listed.


2 Answers

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.

like image 154
daroczig Avatar answered Oct 22 '22 04:10

daroczig


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

like image 20
Bryan Shalloway Avatar answered Oct 22 '22 03:10

Bryan Shalloway