Search code examples
rknitrcranvignette

Leftovers from knitr


I am using knitr to write a vignette for my package. In R CMD CHECK I got the following NOTE:

The following directories look like leftovers from 'knitr'
  ‘cache’, ‘figure’

These are indeed directories created by knitr. But I don't understand how I can remove these after knitting the document into .pdf.

I found one related issue on github but no answer.


Solution

  • One solution is to put

    figure$
    cache$
    

    in a .Rbuildignore file in the main package directory. This only works if you R CMD check on a built tarball rather than on the package source directory, but that's recommended as best practice anyway ... and it's effectively (I think) what the "Check" button in RStudio does, i.e. calling devtools::check, which

    automatically builds and checks a source package, using all known best practices

    (emphasis added).