[TxMt] problem with R interaction [was math bundle feature request]

Hans-Joerg Bibiko bibiko at eva.mpg.de
Fri Dec 8 20:49:38 UTC 2006


[...]

There are pro and cons to perl/ruby/php/R/...
By myself I'm using perl and R ;)

But I looked at the R-Bundle and I wrote a command (in bash) which  
executes R directly in script mode à la

R --no-save --silent <<< "$TASK" 2>/dev/null

There is no need to use Applescript or running R.app in beforehand to  
calculate some tiny things, pasting results to and fro...

This command takes the Selection or Line, executes this by using R,  
and replaces the Selection with the result without leading '[]'. If an  
error occurs or 'Inf' or 'NaN' is returned it shows a tooltip.

Please note, this is only a fast written script as a basis for  
discussions, and can modified in any direction. I tried it out and  
things like
1/1e-1, 100^2, mean(c(1:20)), print("HALLO") worked fine.
Things like 'matrix(c(1:20),nrow=4) also work but without leading row  
numbers of course. Warnings and error messages are suppressed.

Maybe this could be an approach to solve this problem with R.

An other approach could be the rinterp

http://wiki.r-project.org/rwiki/doku.php?id=developers:rinterp

I use this on my Linux server and it works perfectly. With the help of  
this you can write raw R source code within a command in TM and  
executes this like perl, ruby, python etc.

The only thing I don't know whether it is possible to compile this on  
a Mac. I can remember that you have to compile R with shared libraries  
in beforehand, but I'm not quite sure about that.




-Hans



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Calculate in R.tmCommand.zip
Type: application/zip
Size: 777 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20061208/fb7b214e/attachment.zip>


More information about the textmate mailing list