[ESS] Automatically pasting R output into script buffer?
Aloke Phatak
Aloke.Phatak at csiro.au
Fri Oct 14 11:03:12 CEST 2011
On 14/10/2011 4:38 PM, Stephen Eglen wrote:
> Aloke Phatak<Aloke.Phatak at csiro.au> wrote:
>
>> [...] I'd like to be able to execute a command from the script
>> buffer (using C-c C-j, for example) and have its output pasted
>> into my script directly below the command I've just executed.
>>
>> Is that possible?
>
> I don't think its possible with ESS as-is. [...] Would you
> have the output commented?
Yes, sorry, I should have been more precise, the output would be
commented. The resulting file *could* be used as a script file, but I
tend to use such files for documenting analyses that I've done - sort of
like a text-based, poor-man's version of Sweave. I do use Sweave, but
for quickly documenting an analysis for future reference or to pass on
to colleagues, I prefer a heavily-commented transcript file.
> you might want to take a look at org-babel for this. It does more than
> what you want, but e.g. you can have chunks like this in an R buffer:
>
> #+begin_src R :results output
> x<- rbinom(100, 10, 0.5)
> range(x)
> #+end_src
>
> and then hit C-c C-c within that chunk; you should then get:
> #+results:
> : [1] 1 8
>
> My ESS tutorial this year gives the relevant background.
> http://www.damtp.cam.ac.uk/user/sje30/ess11
Looks interesting already!
Aloke
More information about the ESS-help
mailing list