Re: [R] Error handling

From: Gabor Grothendieck <>
Date: Tue 24 May 2005 - 07:38:21 EST

On 5/23/05, Carsten Steinhoff <> wrote:
> Hi,
> I have written an R-Procedure that automatically does a ML-Fit for some
> datasets to a few
> selected distributions. After any optimization the function writes the
> estimated parameters into a variable.
> My problem is now that sometimes the optimization failes and my program
> stops with an error message.
> What I want after a failed optimization is that there is written an error
> msg
> in the variable instead of stopping the program.
> For the ML-Fit I use the "fitdistr" algorithm.



For example, using try:

result <- try(myfun(...whatever...))
if(inherits(result, "try-error")) ...process the error... mailing list PLEASE do read the posting guide! Received on Tue May 24 07:41:17 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:01 EST