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