[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: Org-mode and ESS
From: |
Detlef Steuer |
Subject: |
[Orgmode] Re: Org-mode and ESS |
Date: |
Wed, 12 Nov 2008 21:45:23 +0100 |
This looks just quite cool.
:-)
I am certainly interested, just starting to prepare a lecture I'll
have to give next term and looking for right tool.
So, where to grab it? It would be great to collaborate on this, but I fear
my emacs skills are _very_ limited. (My only excuse: I converted from VIM to
emacs after 15 years ... ESS and org made the difference!)
detlef
On Wed, 12 Nov 2008 14:42:24 -0500
Austin Frank <address@hidden> wrote:
> On Tue, Nov 11 2008, Graham Smith wrote:
>
> > Is any one using Org-mode with ESS. ESS seems to need a file with a
> > *.R name to work, but it would be really useful to use Org-mode
> > features to keep notes of comments and code, before sending to R, and
> > of course to copy results back into an Org-Mode file from R.
> >
> > As a search here and a google hasn't thrown up anything obvious, I
> > assume not, but I thought I would ask.
>
> In my local git repo of the org sources I have a pretty nice setup for
> using R or S inside org-mode. I liked the in-file native editing of
> source code so much that I decided that I wanted to use org files as
> source files with Sweave (instead of using .Rtex or .Rnw files). My
> goal was to export documents with embedded R code, rather than to use
> org within the comments of R files. I can certainly see a use for the
> latter approach (which seems to be what you have in mind), as well.
>
> There was recently a thread where someone created a preprocessing system
> for specific types of blocks. That would be another possible strategy
> for evaluating blocks of R code before export. Since that facility
> didn't exist yet and there was already the extensible Sweave
> pre-processor, I took the route of making Sweave org-aware.
>
>
> Basically, in the workflow I've developed, I create a file with the
> extension .Rorg, say homework_key.Rorg. Within that file, I can embed
> blocks of R code, and can refer to variables defined in the R code
> contained in the document.
>
> --8<---------------cut here---------------start------------->8---
> #+BEGIN_R
> a <- 3
> a
> #+END_R
>
> * the value of a is \R{a}
> * the value of a + 3 is \R{a + 3}
> --8<---------------cut here---------------end--------------->8---
>
> Executing C-c ' inside the block takes you into a temporary buffer
> that's in ESS mode, with full support for interactive evaluation.
>
>
> When I'm ready to export, I run the R command
>
> Sweave("homework_key.Rorg", driver=RweaveOrgLatex, syntax=SweaveSyntaxOrg).
>
> (I've defined those driver and syntax functions locally). This creates
> a new file, homework_key.org. In the new file, the above text would be
> translated into
>
> --8<---------------cut here---------------start------------->8---
> #+BEGIN_LATEX
> \begin{Schunk}
> \begin{Sinput}
> > a <- 3
> > a
> \end{Sinput}
> \begin{Soutput}
> [1] 3
> \end{Soutput}
> \end{Schunk}
> #+END_LATEX
>
> * the value of a is 3
> * the value of a + 3 is 6
> --8<---------------cut here---------------end--------------->8---
>
> The plain homework_key.org file could then be exported into \LaTeX. It
> even works with the new pdf export.
>
>
> I haven't put the code anywhere public because there are several things
> I still need to do:
>
> - test graphic creation and export
> - improve generation of latex headers
> - automate processing from .Rorg to .tex (or .pdf) (currently at least 3
> steps, should be 1)
> - come up with suggested keybindings for inserting the #+BEGIN/END_R
> blocks
> - create a driver to generate HTML instead of \LaTeX
>
> Still, it is in a works-for-me state at the moment, and I could send a
> pull request to Carsten or could push it worg if folks were interested.
>
> Let me know,
> /au
>
>
> --
> Austin Frank
> http://aufrank.net
> GPG Public Key (D7398C2F): http://aufrank.net/personal.asc
>
--
Wisely, and slow. They stumble that run fast. - Shakespeare