[ESS] Is there a simple newbie guide to using knitr in ESS

Chris Evans chrishold at psyctc.org
Sun Feb 10 16:36:11 CET 2013

Dear all,

I am very keen to switch to knitr and a better literate statistics way of using R.  I have been a long term user of emacs though never emacs lisp and a fairly long term (a decade?) user of ESS to handle R.  I have never managed the switch two sweave both because I've equally never made the switch to TeX mainly because in my substantive field sadly everyone uses M$ Word documents and the learning curve for TeX on top R was just too much for me.

KnitR seems much easier for me to use and the HTML output (or PDF) is OK if not ideal for sharing with colleagues and collaborators so I started using it in Rstudio but I have yearned to come back to ESS as Rstudio is clever but too often left me feeling I really didn't know how to debug it and missing my usual keyboard commands.

I was very pleased to see that knitr support is now in ESS but I'm failing hopelessly to use it.  I had, perhaps naively, assumed that I could take .Rmd files that had worked in Rstudio, starting with its initial template one, open it in emacs/ESS and be away but that's absolutely not the case!  I then searched around and found correspondence here from last year including a request from Pierre Kleiber from October last year that is really the same as mine request now:

"Being a long-time user of R and ESS but never having tried sweave or other
literate programing systems, I would like to try knitr. I'm searching for a
knitr tutorial that makes use of ESS rather than RStudio. Can anyone direct me
to such a tutorial?"

I can't see any answer and most of what I find about ESS/knitR is about technicalities of what has to be done internally in ESS to make it work ... nothing (not that I can understand) on how I can use it.

It seems clear to me that Vitalie and others have got things in ESS so that it works for them with their expertise. Please would someone tell me how I could take this default file from Rstudio (attached) and rename it or get ESS to recognise that it is in a markdown form suitable to be parsed and knitted up by knitR and R?  Questions:

1) ESS doesn't seem to recognise it as any special file at all.  Does ESS expect another file extension (.rnw?) 
2) I think I have to tell ESS to use knitr not sweave by setting a variable.  Is there a way I can make that a permanent instruction as I don't use sweave?
3) I suspect there are other things I need to do?!



More information about the ESS-help mailing list