Zhongming,
> R Users:
>
> How can I catch R errors and depend on this error call other R
> functions in Perl?
I am working on similar issues, perhaps. The simple CGI-type approach I am
exploring just involves having Perl check for such a string, such as
"Execution Halted" or the one you saw. Then you can decide what to do
with
Perl for reporting the error. For a more general solution, it may be that
you add a simple cat() string that says your R function/program succeeded
and then have Perl check for that. (I presume you are using Perl's system()
to make the call from Perl to R.)
To get more information from R about the exception/error in your program,
see various related functions, such as options("show.error.messages"),
geterrmessage(), try(), traceback(), etc. There is a lot of flexibility in
both R and Perl to customize things as specific-to-general as you want them.
Hope this helps.
Best,
Bill
----------------------------------------
Bill Pikounis, Ph.D.
http://biometrics.merck.com/
Biometrics Research Department
Merck Research Laboratories
PO Box 2000, MailDrop RY84-16
126 E. Lincoln Avenue
Rahway, New Jersey 07065-0900
USA
v_bill_pikounis at merck.com
Phone: 732 594 3913
Fax: 732 594 1565
> -----Original Message-----
> From: Zhongming Yang [mailto:Zhongming.Yang at cchmc.org]
> Sent: Wednesday, January 15, 2003 10:35 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Exception Handling
>
>
> R Users:
>
> How can I catch R errors and depend on this error call other R
> functions in Perl?
>
> The foolowing is the error message when I use perl call R.
>
> Error in nls(modout ~ exp(-b1 * modin)/(b2 + b3 * modin), trace = F,
> start = c(b1 = 0.005, :
> singular gradient
> Segmentation fault
>
>
>
> Thanks,
>
> Zhongming
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
------------------------------------------------------------------------------