[R] Detecting incomplete commands
thpe at hhbio.wasser.tu-dresden.de
Thu Dec 16 15:17:55 CET 2004
Philippe Grosjean wrote:
> 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:
> This is fine!
> 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)
why not using something like this:
> ok<-try(parse(text="ls("), silent=TRUE)
 "Error in parse(file, n, text, prompt) : parse error\n"
and then check if "ok" is an expression:
More information about the R-help