I noticed that with a large dataset knitr
takes an unexpected long time to compile my document: about 23 minutes from when knitr
completes the last chunk to when it writes the .tex. I don't understand what it is doing while taking so long because according to the log this long time span occurs between
|.................................................................| 100%
inline R code fragments
and
output file: mydocument.tex
[1] "mydocument.tex"
without knitr
echoing anything in the log to give indication of what it is computing.
Looking at when the file was last modified, it appears that the cache from the last chunk has not been updated during this long time span. Actually no file in the document folder/sub-folders is modified during this time.
What is knitr
processing just before writing the .tex file? Is there anyway to speed this up through caching? Could help if I set cache=TRUE
as default?
opts_knit$set(verbose=TRUE)
, and then you will see what is being computed after you callknit()
; basically it shows you the code in\Sexpr{}
;cache=TRUE
only works for code chunks, and does not work for inline code