enter browser on error
Have you tried options(error=recover)?
On Tue, 31 Aug 2004, Bickel, David wrote:
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.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595