[TxMt] Re: R-package - strange parsing errors

Hans-Jörg Bibiko bibiko at eva.mpg.de
Thu Oct 13 20:35:09 UTC 2011


On 13 Oct 2011, at 20:23, Martin Batholdy wrote:

> But now I stumbled over a big problem parsing code to the Rdaemon
> (by selecting the code and pressing CMD+T or selecting "execute selection").
> 
> 
> It is a rather long script and some of the lines at the end of the script do not get parsed correctly.
> They kind of get completely screwed up leading to error messages.
> 
> 
> For example, this line in the original code:
> 
> for(i in 1:length(x)) {   prt_reduced[,x[i]]  <- reorder(prt_reduced[,x[i]], c(2,1)) }
> 
> looks like this after pressing CMD+T:
> 
> > for(i in 1:length(x)) {   prfor(i in 1:length(x)) {   prfor(i in 1:length(x)) {   prfor(i in 1:egory
> Error: unexpected 'in' in "for(i in 1:length(x)) {   prfor(i in"

Hi Martin,

before I can try to help you I've a question. You mentioned the bundle Rdaemon and CMD+T.
If your TextMate window runs in the Rdaemon mode then you can simply press RETURN to execute the current line. Or do you mean the R bundle? Or do you mean running Rdaemon and having a separate "R" window open?
And CMD+T key equivalent is new to me.

If you run a very large script in "R" mode, including the selection of lines of code, and press CMD+R or in Rdaemon mode SHIFT+CMD+R, then the selected text will be passed via STDIN to a script which reads the text line by line. I do not know ad hoc where the maximum size in respect of the underlying BASH/Ruby script is but I've never come across with such an issue. Can you tell us how large in terms of MBytes and lines "rather long script" is? (simply copy your selection to a new file and save it and look in the Finder how large it is)

[I've just run a script with 2500 lines, ok, it took a while, but finished successfully]


Tiny note:
CMD+R in "R" mode executes the selection or if no selection is present the entire document, thus there's no need to "Select All" CMD+A in beforehand.



Best,
--Hans


More information about the textmate mailing list