Knitr: keep cache when I make small changes to a piece

I understandably broke the cache when updating the piece (however, the result should be the same, these were cosmetic changes). However, I do not want to start the piece again, because it takes 1 week to start. How to change the cache so that the new code considers that the cache is stored?

I think I just need to change the file names in the cache folder. But I do not know how to change them without running the code, because knitr only writes files after the successful completion of the piece.

Another motivation is that the cache cache can be invalidated by using different versions of knitr. This happened to me between 1.5 and 1.5.33, development versions. See also here: R knitr: is it possible to use cached results on different machines? . I think that if I find a solution to the above that can help with this.

+4
source share
1 answer

Using a cache knitrto store the results of a weekly simulator sounds a bit crazysubject to disaster.

My suggestion for a safer workflow:

  • Run the simulation and save the results in a file (csv, rda, whatever suits you).

  • (, echo = FALSE) knitr.

.

+4

Source: https://habr.com/ru/post/1541367/


All Articles