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.

JHowIX
  • 299
  • 1
    Do you know about the cacheing options? See http://stackoverflow.com/questions/9538367/ and http://stackoverflow.com/questions/10628665. I believe to use with Sweave there are extra hoops to jump through but that it's built into knitr. – Aaron left Stack Overflow Sep 23 '14 at 02:08

1 Answers1

4

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

WojciechF
  • 238
  • 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 '14 at 06: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 '14 at 07:00
  • Thanks all, after reading up on Knitr and cache this appears to be exactly what I wanted. – JHowIX Oct 07 '14 at 17:55