[R] Detecting incomplete commands

Philippe Grosjean Philippe.Grosjean at umh.ac.be
Thu Dec 16 10:43:51 CET 2004


Hello,

I need a similar behaviour as with the prompt: asking to complete incomplete
R command with eval(parse(text = ....))
Is it a way to make the difference between an illegal and an incomplete R
command in a string?
For instance:

> parse(text="ls()")
expression(ls())

This is fine!

> parse(text="ls(")
Error in parse(file, n, text, prompt) : parse error

This is an incomplete command, and I want to ask to the user for further
input (multiline command)

> parse(text="ls())")
Error in parse(file, n, text, prompt) : parse error

This is clearly an illegal command. Could I make a distinction with the
previous case here?
Best,

Philippe Grosjean

..............................................<°}))><........
 ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
 ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons-Hainaut University, Pentagone
( ( ( ( (    Academie Universitaire Wallonie-Bruxelles
 ) ) ) ) )   6, av du Champ de Mars, 7000 Mons, Belgium  
( ( ( ( (       
 ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.33.12
( ( ( ( (    email: Philippe.Grosjean at umh.ac.be
 ) ) ) ) )      
( ( ( ( (    web:   http://www.umh.ac.be/~econum
 ) ) ) ) )
..............................................................




More information about the R-help mailing list