[R] interaction of options(error=) and try()

John Chambers jmc at research.bell-labs.com
Tue Jan 7 20:13:03 CET 2003

Luke Tierney wrote:
> On Tue, 7 Jan 2003, Vadim Ogranovich wrote:
> > Dear R-Users,
> >
> > I am somewhat confused by the interplay between options(error=) and try(). I
> > set my error handler to an expression that dumps the frames and quits. Yet,
> > I thought that this handler would NOT be invoked if an error happens within
> > try(). Apparently it was. Here is the code that I ran as R BATCH:
> The current implementation of try does not override the error handler
> setting provided in options.  This will change when a more
> sophisticated error handling mechanism currently under development is
> released.  For now I thnk your only option is to disable your error
> handler around the try.

The methods package has a function, trySilent(expr), that turns off the
error option while doing the try, basically what Luke is suggesting. 
(It's only in that package because it was needed there; it doesn't
involve methods.)

John Chambers

> luke
> --
> Luke Tierney
> University of Iowa                  Phone:             319-335-3386
> Department of Statistics and        Fax:               319-335-3017
>    Actuarial Science
> 241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
> Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help

John M. Chambers                  jmc at bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc

More information about the R-help mailing list