[R] No traceback available when using try(...)

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Mar 12 20:54:23 CET 2004


Thomas Lumley <tlumley at u.washington.edu> writes:

> On Fri, 12 Mar 2004, Roger D. Peng wrote:
> 
> > Funny, it works for me on R-patched
> >
> >  > f <- function(a) { return(log(a)) }
> >  > f("A")
> > Error in log(x) : Non-numeric argument to mathematical function
> >  > traceback()
> > 2: log(a)
> > 1: f("A")
> >  > try(f("A"))
> > Error in log(x) : Non-numeric argument to mathematical function
> >  > traceback()
> > 2: log(a)
> > 1: f("A")
> >
> 
> No, it doesn't.  The second traceback() call is printing the *previous*
> trace information, which in this case is the same.

Right, same thing here.
 
> The bug in 1.8.1, which *is* fixed, is that you didn't get traceback
> information anywhere, rather than not getting it with try()

(Is is obvious that you *should* get a traceback from inside try()?)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list