[ESS] knitr

Vitalie Spinu spinuvit at gmail.com
Wed Oct 3 11:37:40 CEST 2012

  >> Yihui Xie <xie at yihui.name>
  >> on Tue, 2 Oct 2012 16:05:57 -0500 wrote:

  > There is 100% guarantee for *.Rnw documents; one thing I can think of
  > is to see if opts_chunk is used in the document, e.g.
  > opts_chunk$set(echo = TRUE). This is unique to knitr. Other minor
  > differences are like results='hide' (knitr) vs results=hide (Sweave).

  > If a document uses \usepackage{Sweave}, it is more likely to be Sweave
  > because knitr does not need this. The other approach is to check if
  > (require('knitr')) in R before weaving the file.

A bit of a problem is that ess-swv-processor is a custom variable, and
is not good to mess with it programmaticaly. It's not good to ignore it
either if opts_chunk is present or knitr is loaded. 

To relatively quickly switch the processor one can do M-x set-variable RET
ess-s-pro TAB RET 'knitr RET. Alternatively people can just use
specialized shortcuts M-n r and M-n u, not a big deal.


  >> I'm in a transition period -- I have several Sweave files, and think
  >> knitr is more flexible, so currently am writing new docs in knitr.

Yes, knitr is so much, much better and easier. Thanks Yihui. It's our
job now to correctly leverage the full power of knitr in ESS.


More information about the ESS-help mailing list