[R] .Traceback

Duncan Murdoch dmurdoch at pair.com
Mon Jun 14 16:53:41 CEST 2004


On Mon, 14 Jun 2004 16:38:48 +0200, "Wolski" <wolski at molgen.mpg.de>
wrote :

>Hi!
>
>Is there a way to write the information stored in the .Traceback variable to a file?
>
>When I try it with dump()
>".Traceback" <-
>list("dump(.Traceback, file = \"Mytraceback.R\")") 
>
>Or there are other ways to write this information on the disk if an error occurs?

dump() is usually used when you want to recreate the object.  Here,
you probably just want to print it, so something like

sink('error.txt')
traceback()
sink()

might do a better job.  But if you really want the .Traceback list, I
think you just need to assign it to a new variable before dumping,
e.g.

saveTrace <- .Traceback
dump('saveTrace', 'whereever.R')

I imagine the problem you're having is from some special case code to
handle the .Traceback variable in a dump, but I haven't checked the
source to see.

Duncan Murdoch




More information about the R-help mailing list