4

I am writing a large document using a Latex, WinEdt, RStudio and Sweave. I have a large number of graphs that use SWeave code blocks (>30). Many of these blocks read in large data files from disk. Most days I work on on 2-3 blocks at a time. However, no matter how minor a change I make to the R code, every time I compile, the entire document must run through R. This can take 5-10 minutes.

I guess what I am looking for is a combination of a C/C++ make file and R/Sweave. Does such a concept exist or am I being too needy?

Thanks in advance for the help.

1

1 Answer 1

4

When using RStudio with knitr package just put <<cache=TRUE>>= in those chunks you want to skip during recompilation.

3
  • 3
    Unless there is a new development I have missed, plain Sweave does not support caching of results. As Aaron commented, the options are to use knitr or go through "extra hoops" to add caching to Sweave.
    – mvkorpel
    Sep 23, 2014 at 6:55
  • 2
    Oh, you are right! Using Sweave in R studio with knitr package just comes so natural that it was my first thought. And it is simply no fuss at all. I edited my answer.
    – WojciechF
    Sep 23, 2014 at 7:00
  • Thanks all, after reading up on Knitr and cache this appears to be exactly what I wanted.
    – JHowIX
    Oct 7, 2014 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.