[R] enter browser on error

Tue Aug 31 19:26:00 CEST 2004

Is there a way I can get R to automatically enter the browser inside a user-defined function on the generation of an error? Specifically, I'm trying to debug this:

Error in as.double.default(sapply(lis, FUN)) : 
        (list) object cannot be coerced to double
In addition: There were 38 warnings (use warnings() to see them)
> traceback()
8: as.double.default(sapply(lis, FUN))
7: as.numeric(sapply(lis, FUN))
6: numeric.sapply(function(x) {
       x at statistic0

On detection of the error, I would like browser() to be called at the level of numeric.sapply(), so that I can examine x. I'm wondering if this can be done by modifying the default error handling. Using try() with browser() didn't work.

David Bickel  http://davidbickel.com
Research Scientist
Pioneer Hi-Bred International
Bioinformatics & Exploratory Research
7250 NW 62nd Ave., PO Box 552
Johnston, Iowa 50131-0552
515-334-4739 Tel
515-334-6634 Fax
david.bickel at pioneer.com, bickel at prueba.info

This communication is for use by the intended recipient and ...{{dropped}}

More information about the R-help mailing list