user2252705
user2252705

Reputation: 73

R knitr: is it possible to use cached results across different machines?

Issue solved, see answers for details.

I would like to run some code (with knitr) on a more powerful server and then maybe have the possibility of making small changes on my own laptop. Even copying across the entire folder, it seems that the cache is rebuilt when re-compiling locally, is there a way to avoid that and actually use the results in the cache?

Upvotes: 5

Views: 199

Answers (2)

Yihui Xie
Yihui Xie

Reputation: 30124

Update: the problem arose from different versions of knitr on different machines.


In theory, yes -- if you do not change anything, the cache will be kept. In practice, you have to check carefully what the "small changes" are. The documentation page for cache has explained when the cache will be rebuilt, and you need to check if all three conditions are met.

Upvotes: 5

Greg Snow
Greg Snow

Reputation: 49640

I wonder if in addition to @Yihui's answer if the process of copying from one machine to another changes the datetimes on the files so that they look out of date even when nothing has changed.

Look at the dates on the files involved after copying. If you can figure out which files need to be newer than others then touching them may prevent the rebuilding.

Another option would be to just paste in the chached pieces directly so that they are not rerun (though that means you have to rerun and repaste manually if you change anything in those parts).

Upvotes: 0

Related Questions