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

Steve Lianoglou mailinglist.honeypot at gmail.com
Sun Feb 10 16:48:22 CET 2013


Hi Chris,

Last I checked, I'm pretty sure that the only kintr support in ESS is
to have Sweave (*.Rnw) be piped through knitr instead of sweave for
compilation of the semi-tex -> tex -> output.

I would love to be told that I'm wrong, but it's my impression that
Rmarkdown files are not really supported.

As an alternative, I believe others have suggested to use org/babel,
which *should* get you pretty close to an Rmarkdown-like document:

http://orgmode.org/worg/org-contrib/babel/

If I were a better person, I would have gone that route myself, but
I've been using a different editor (Sublime Text 2) to whip up
Rmarkdown documents.

-steve

On Sun, Feb 10, 2013 at 10:36 AM, Chris Evans <chrishold at psyctc.org> wrote:
> 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?!
>
> TIA,
>
> Chris
>
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>



-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the ESS-help mailing list