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? Eryk
"Wolski" <wolski at molgen.mpg.de> writes:> 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?You can assign it to a variable of a different name and save that. I suspect that is the only way. E.g., f <- function() foo() lm(y~x,data=f()) # lazy evaluation makes this interesting x <- .Traceback dput(x) # or dump("x"), or save(), or.... -- 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
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