ulyngs / oxforddown

Template for writing an Oxford University thesis in R Markdown; uses the OxThesis LaTeX template and was inspired by thesisdown.
https://ulyngs.github.io/oxforddown/
MIT License
221 stars 81 forks source link

Enable cache options for main document #37

Closed SbastianGarzon closed 2 years ago

SbastianGarzon commented 2 years ago

Hi, Is there a way a to enable the cache options for the knitting process from the index.Rmd for all chapters ? The cache options work for individual chapters chunks :


```{r complex_ggplot, cache = TRUE}

ggplot()+....

```_

However, every time I knit the main document (i.e., index.Rmd) it starts the process ignoring any cache.

ulyngs commented 2 years ago

That sounds odd - I don't see why the cache options set in the individual chunks would be overridden when you knit the main document, and it seems to work for me.

Can you provide a minimal reproducible example?

SbastianGarzon commented 2 years ago

I can work later in a minimal reproducible example, however I think the problem originates here :

https://github.com/ulyngs/oxforddown/blob/61fe78c4b3fed2aaf3ab7c57188d86a6bfca3505/scripts_and_filters/knit-functions.R#L27 Isn't it the whole point of that command to remove the cache ? That folder ("_bookdown_files") includes '_main_cache' and '_main_files' directories.

ulyngs commented 2 years ago

Whoooooopsie, you're completely right! Just fixed this in a801797!

(Now you have to explicitly set allow_cache = FALSE in the knit_thesis function if you want to remove the _bookdown_files folder, cf. d43159e)