[R] How to catch a R error in R code

HU,ZHENGJUN hhu at ufl.edu
Wed Oct 10 15:49:54 CEST 2007

Hi All,

  I entered a R statement, e.g. 1:20 = x or log("a") on an HTML 
form and passed it to a R-CGI script. Obviously, neither of both 
is a correct R statement or expression. However, my R-CGI script 
could not return and report the error message to the Web site even 
though it received the statement. I tried to use some R built-in 
functions of try, tryCatch, eval, expression, as.expression, 
parse, deparse, etc. None of them worked.

  Note: when a statement is correct, i.e. x = 1:20 or log(2), the 
same script returned and reported the R output to the Web site.

  If any of you has the experience about the matter or topic, 
could you please tell me how to catch a R error in this case?

  Thank you very much for the help in advance.

More information about the R-help mailing list