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

Martin Batholdy batholdy at googlemail.com
Thu Oct 13 21:23:01 UTC 2011


Dear Hans,


> And CMD+T key equivalent is new to me.

I am sorry – I  probably redefined this shortcut by myself.


I work in the Rdaemon mode (is that how you call it in TextMate?).

I start the Rdaemon with CMD+enter and then execute selected lines with the "execute selection" menu item.
A small window pops up with a progress bar and the message "sending task to Rdaemon". 
After this is finished the selection converts to R-output.

I don't have a separate R-window open.


> 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

So I think this is how I work with the package.


The script is actually not that large.
It is just about 200 lines of code (8kb on disk).

But since I get this strange parsing-behavior always at the end of the script, I thought it has something to do with that.

But perhaps it also has something to do with the amount of data I do calculations on in this script.
I am currently working with matrices that occupy more than 1gb of ram.


But I observed this behavior already some time ago in a different script and there I wasn't working with a large data-set.
So I thought it has nothing to do with that.
 

One more hypothesis :) :
Perhaps it has something to with repeating statements that are very similar.
In the example of the for-loop, there were actually four of these very similar loops after another.
And before that I had also this strange behavior in four lines of code which also were very similar (use of the same functions on the same data.frame etc.)


I try to come up with sample-script.
Perhaps I can manage to replicate this behavior with generic data.



best,
martin




On 13.10.2011, at 22:35, Hans-Jörg Bibiko wrote:

> 
> 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
> 
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate



More information about the textmate mailing list