[TxMt] Re: Getting Rdaemon to echo code + output (like ESS)

Hans-Jörg Bibiko bibiko at eva.mpg.de
Sun Mar 29 10:14:21 UTC 2009


On 29.03.2009, at 04:52, Kieran Healy wrote:
> Can the Rdaemon bundle can behave in a way that's similar to ESS in
> Emacs (or as near as possible given that TextMate doesn't do split
> windows and frames, etc). What I want is to have an R file open in one
> window (associated with the R bundle) and an R session created under
> Rdaemon open in a second window. I write R code in the R file and, as
> needed, send chunks of it over to the R session where they are
> executed. [...] The code is echoed in the R session when you
> send it over, together with any errors or output, etc.
>
> In TextMate, I can have an R file open and an R session running in
> Rdaemon, which is great. I can select code and use "Send Selection to
> Rdaemon", but it works in the background (or rather, with a progress-
> meter message box). The code executes properly, but it and its output
> are not echoed in the open Rdaemon window. [...] But what I want is  
> to see code chunks
> (and their output) inside the Rdaemon window as I go. Is this  
> possible?

Hmm, the main issue here is that the output of the R session is not  
bound to any specific TM window ('only' to the current one). This is  
an advantage, I can run R code also from other docs like from a TeX  
file; but has also its disadvantages.

If I would bind the output of the R session to one window then one  
would have the problem how to update/reach that window (it would be  
possible but ...)

I'm using very often your mentioned workaround, two windows, for  
developing a function for instance. Then I send the function to the  
Rdaemon, switch to the Rdaemon window, and try it out. If an error  
occurred in that code sent a new window would be opened mentioning the  
error code.

On the other hand one should ask why one needs the behaviour you  
mentioned. One can do this also in a doc associated to Rdaemon.  
Remember the Rdaemon doc is NOT a time-linear console, it's still an  
editor window, thus you can run code, go some lines back, run an other  
command, press ⌘Z for undo, correct the command, delete unused stuff,  
etc.
In other words why are you using two windows?
See: http://www.bibiko.de/TM_R_ex01.mov as naïve example.

OK. This workaround is totally different from the 'normal' R console,  
but since I'm using it all the time I have really problems to use  
R.app or the Terminal because I miss this flexibility.

Nevertheless I'll try to find a workaround similar to that one you  
mentioned.


--Hans


More information about the textmate mailing list