[Tex/LaTex] What do Sweave/knitr offer that make doesn’t

knitrmakefilesweave

I use LaTeX to write papers and R for data analysis and visualization, so I've been looking into Sweave and knitr.

The Sweave website says:

The purpose is to create dynamic reports, which can be updated automatically if data or analysis change.

But it seems to me that I already have this in my current workflow, with a makefile that runs my R scripts and then compiles my LaTeX with the figures and tables generated by the scripts.

The make approach is also really good with caching, e.g., it checks the timestamps of my data files as well as source files to know when to recompile individual components.

And it seems like with Sweave/knitr, I lose ability to run just my R or my LaTeX, separately.

Am I missing something? What do solutions like Sweave and knitr offer that make doesn't?

Best Answer

I'm still new to LaTeX (about 2 years of use) but have found knitr very helpful for:

  • inline code
  • code chunks - incredibly helpful for execution and then interspersing your document with it
  • dead simple graph integration into document
  • caching (I'm sure you could do this with make by watching file changes)
  • an amazingly responsive support community (at least on #r on freenode)

From the knitr website:

knitr ≈ Sweave + cacheSweave + pgfSweave + weaver + animation::saveLatex + R2HTML::RweaveHTML + highlight::HighlightWeaveLatex + 0.2 * brew + 0.1 * SweaveListingUtils + more

I do however use the now considered outdated rubber for compilation, so I'm sure others can provide more context with regards to make specifically.