R-beta: Still want restart() in R

Thomas Lumley thomas at biostat.washington.edu
Thu Oct 23 17:58:45 CEST 1997


On Thu, 23 Oct 1997, Martyn Plummer wrote:
> On 23-Oct-97 fear at scmp.scm.liv.ac.uk wrote:
> >People's valiant efforts to sort out CODA aside, the burning question remains:
> >has anybody made any headway with restart()? or any other way (and there may 
> >well be better) of trapping `fatal' errors from calls within a function.
> 
> I don't think restart() is necessary - it just seems like an invitation
> to bad programming to me. I would, however, like a safe parse function
> which would return a user-defined error code instead of crashing if
> the input is invalid.  Such a function could then be safely called
> from another function and allow very general user input. 


I think some way of trapping errors in arbitrary functions would be
useful.  The problem is that someone else may have written the code, in
which case bemoaning their bad programming practices is a little
unproductive.  I have had a lot of trouble with simulations of a
function that crashes with a "singular matrix" about 10% of the time. In S
I could at least use a For() loop, which would skip over the errors. In R
I can't do this. If I run in batch mode I can't even restart the
simulation automatically since R stops on all errors.

The only problem is that the R scoping rules make it impossible to
guarantee that you can recover completely after an error.  Changes may
have been made to existing environments.  This is rare enough that we can
probably live with it -- especially as the main reason to trap errors
would be in self-contained code written by someone else.

	-thomas

Thomas Lumley
------------------------------------------------------+------
Biostatistics		: "Never attribute to malice what  :
Uni of Washington	:  can be adequately explained by  :
Box 357232		:  incompetence" - Hanlon's Razor  :
Seattle WA 98195-7232	:				   :
------------------------------------------------------------

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the R-help mailing list