Non-Contradiction / JuliaCall

Embed Julia in R
https://non-contradiction.github.io/JuliaCall/index.html
Other
264 stars 36 forks source link

Using knitr chunks caching feature with Julia via JuliaCall knitr engine #38

Open konstunn opened 6 years ago

konstunn commented 6 years ago

How can I use knitr caching feature with Julia via JuliaCall. Tell me, please, how can I achieve that, if it is possible?

And one more question is if it is possible to speed up loading Julia setup script? These two questions are relevant to each other in the aspect that I'm looking for speeding up my document build.

konstunn commented 6 years ago

Oh, it seems that it is not that hard to make caching works. I got it work.

Non-Contradiction commented 6 years ago

The caching feature works except for the objects in julia, which of course can not be cached by R process.

I was once considering to cache julia objects if necessary by using some other julia packages, maybe looking for some julia functions like save.image in R and I can just use it? And this feature will require to interact with knitr cache functionality, for example, knitr has some rules to make validation of the cached code chunk and etc. There is some related and similar in nature discussion about cache of reticulate, which calls Python from R, at https://github.com/yihui/knitr/issues/1505 https://github.com/yihui/knitr/pull/1518 and https://github.com/rstudio/reticulate/pull/167 But I expect solving this problem in JuliaCall should be much easier.

It will be meaningful to have the feature which caches julia objects if needed. But I expect it to be a little complicated. And it doesn't have high priority currently. If you are interested in achieving this, we can discuss more about this, and a PR will be warmly welcomed.