emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: Org-mode and ESS


From: Eric Schulte
Subject: Re: [Orgmode] Re: Org-mode and ESS
Date: Wed, 12 Nov 2008 19:22:08 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Austin Frank <address@hidden> writes:

> 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.

Hi Austin,

I would be interested to help extend the block prepreocessing system to
handle cases like the one you mention here.

>
> 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.
>
> #+BEGIN_R
> a <- 3
> a
> #+END_R
>
> * the value of a is \R{a}
> * the value of a + 3 is \R{a + 3}  
>

In the above example how would you/Sweave handle the case where there
are multiple R blocks in the same file?  For example

#+BEGIN_R
a <- 3
a
#+END_R

- the value of a is \R{a}
- the value of a + 3 is \R{a + 3}  

#+BEGIN_R
a <- 8
a
#+END_R

- the value of a is \R{a}
- the value of a + 3 is \R{a + 3}  

With that questions answered it should be relatively straightforward to
implement exporting as you described using only org-mode's block
processing, and letting ESS do the actual calculations all without any
dependence on Sweave.

> I haven't put the code anywhere public because there are several things
> I still need to do:
>
> - test graphic creation and export

if you have examples of graphic creation, I'd be interested to see how
they work, and relatedly how difficult it would be to move that
functionality into org-mode.

However I think the rest of the point you make immediately below would
be easily addressed through using an org-mode only approach.

> - 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

If you happen to use yasnippets, I find it makes the creation of blocks
in org files a very quick/easy experience.  See
http://legito.net/worg/org-configs/index.php#sec-2.1 for details.

>
> - create a driver to generate HTML instead of \LaTeX
>

Cheers -- Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]