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
114 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
patchDVI
package 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
Sweave
is finished running that file,patchDVI
will check whether the filessubfile1.Rnw
andsubfile2.Rnw
also need to be run, then will run LaTeX on themain.tex
file once everything is up to date.