[R] Scripting with an external editor

Jim Lemon bitwrit at ozemail.com.au
Mon Mar 24 12:12:14 CET 2003


ripley at stats.ox.ac.uk wrote:
> ?parse says
>
>      `parse' returns the parsed but unevaluated expressions in a list.
>      Each element of the list is of mode `expression'.
>
> that is, it takes all the input and returns a list once all the input
> has been parsed.  There is no multi-tasking in the R evaluator, and you
> have no loop in your code, so eval can only be called once when parse
> exits.
>
> I am not clear what you actually want.  If it is to repeatedly send a
> block of code to R and get that block evaluated then you need to
> indicate the end of the block somehow, split the pipe stream up into
> blocks and run a loop to parse and evaluate each block.  If you want to
> simulate the command-line, the easiest way to do this is to submit to
> the command line, and to help with that you would have to at least tell
> us your platform!

My apologies.

OS - Linux (RedHat 7.2)

I had read the section in the R Language Manual about parsing:

"The read-eval-print loop forms the basic command line interface to R. 
Textual input is read until a complete R expression is available."

The initial aim is to send selected text from the editor to the R command 
line. If I manually invoke the editor from a terminal, I can do exactly 
this, with each section of text appearing as if entered when sent from the 
external editor. However, your suggestion about blocking is probably the 
answer, as I noticed the blocking option but decided that the explanation 
on the help page for "connections" implied that a non-blocking mode would 
be the correct one:

"In non-blocking mode, operations return as soon as possible, so on input 
they will return with whatever input is available..."

Any suggestions would be greatly appreciated.

Jim



More information about the R-help mailing list