[ESS] Interaction with Sweave, knitr, pandoc, polymode et al.
tkp@pp @end|ng |rom gm@||@com
Mon Apr 4 09:22:57 CEST 2016
Definitely: see http://orgmode.org/manual/Exporting-code-blocks.html. In
particular, :exports both will show both the code and the results. Also
see the :results header argument.
On Mon, Apr 04 2016, Stephen Eglen wrote:
> Vincent: we (ess-core) were recently discussing support for Rmd, so
> your questions come at a good time.
> Tamas: Although I like org mode, I think the knitr universe is far
> better optimised for R work. One thing that always bugged me in
> org-babel is that the output goes back into the source buffer. Is there
> a way to turn that off, so that output goes into a separate file and
> then e.g. is compiled to a pdf?
> On Mon, Apr 04 2016, Tamas Papp wrote:
>> Hi Vincent,
>> Sidestepping the issues you mention, I find org-mode (with org-babel)
>> perfectly fine for producing PDF, LaTeX, and HTML files for my
>> workflow. I write code snippets surrounded by text and equations, run
>> them individually when working on the project, then compile the whole
>> file when done. If you want both PDF and HTML, use SVG for graphs,
>> otherwise PDF is fine. C-c ' in org-mode will open your code in an ESS
>> buffer, and you can work on it as usual.
>> See the many tutorials at, for example,
>> On Mon, Apr 04 2016, Vincent Goulet wrote:
>>> Please bear with me, I have many related issues to address.
>>> I had been paying little attention to the process of sweaving with ESS for some time as I didn't have much to do and when I did, it was mostly for large projects on which I rely on makefiles.
>>> I find myself looking into all this more closely these days and also investigating how knitting with rmarkdown works in Emacs.
>>> First, I realize that the mechanisms now in place in ESS to sweave and compile to PDF a .Rnw file perfectly fit my workflow, especially when ess-swv-plug-into-auctex-p is true. One can start compilation with C-c C-c as usual and choose either to only sweave the file or to sweave and then compile to PDF with LaTeX. The TeX engine chosen on the AUCTeX side is honoured as seen to be the encoding of the file. Nice work ESS people!
>>> However, when .Rnw files are associated with poly-noweb+r-mode (from polymode) as is the case in my distribution, the whole ESS and AUCTeX integration seems to be disabled. I think this is unfortunate. Enough to strongly consider removing the default association in my distribution. If one wants to use the whole polymode approach for what I'd consider "pure" Sweave files, one would need to opt-in via ~/.emacs.
>>> What do you people think of that?
>>> Second, polymode appears to be the best choice to work with rmarkdown on Emacs. In order to have my Emacs distribution R Markdown-ready as much as possible, I'd keep at least the following association enabled by default:
>>> (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
>>> Third, pandoc. I discovered that RStudio ships with a version. [And also that rmarkdown has special bindings to find the RStudio version of pandoc, but otherwise lets you on your own. Not impressed.] I thought that doing the same for Emacs could be nice to have a distribution fully markdown and rmarkdown ready. I can tell markdown-mode where to find a parser by setting 'markdown-command'. However, rmarkdown::render() does look at this variable and relies on pandoc being on the shell's path.
>>> If I don't want to install anything outside of the Emacs distribution tree both on Windows and on OS X, do I have any way to configure rmardown or polymode to use a version of pandoc that would be bundled with Emacs?
>>> Thanks in advance for any pointers and ideas.
>>> ESS-help using r-project.org mailing list
>> ESS-help using r-project.org mailing list
More information about the ESS-help