Is there any way to compile knitr subfiles separately? What I have in mind is something like the package subfiles for latex just in combination with R/knitr/Sweave? This would be great in case one has two exercises a first exercise with heavy computations and don't want to compile the entire exercise always while working and testing the second one.
is it possible to compile R latex via knitr in a modula way
147 views Asked by Max Lampe At
2
There are 2 answers
0
On
You don't need to do anything difficult, just use the cache options. Lots of details here, but it's probably as simple as specifying cache = T in the chunk options of your first exercise.
The
patchDVIpackage does this for Sweave. I imagine it would be possible (maybe even easy) to modify it to do the same forknitr.For example, in Sweave, you define variables in a chunk like so:
and after
Sweaveis finished running that file,patchDVIwill check whether the filessubfile1.Rnwandsubfile2.Rnwalso need to be run, then will run LaTeX on themain.texfile once everything is up to date.