5
Desidero misurare i blocchi di knitr e registrare il tempo necessario per renderli utilizzando i commenti nell'output di LaTeX.Hook to time knitr chunks
Ho provato il seguente gancio:
now = Sys.time()
knit_hooks$set(timeit = function(before) {
if (before) { now <<- Sys.time() }
else {
paste("%", sprintf("Chunk rendering time: %s seconds.\n", round(Sys.time() - now, digits = 3)))
}
})
e lo fa produrre il commento corretto con temporizzazione ma il problema è che è avvolto in kframe che si traduce in brutte lacune nell'output LaTeX:
\begin{kframe}
% Chunk rendering time: 12.786 seconds.
\end{kframe}
C'è un modo per produrre commenti non organizzati?
FWIW, è stato crossato su https://github.com/yihui/knitr/issues/1042 –
Avete un MWE che indica _ugly gaps_? – Thell