[R] dump.frames and global environment

Jannis bt_jannis at yahoo.de
Tue Jul 24 16:10:23 CEST 2012


Dear list members,


I am trying to use dump.frames to debug some code that i run non 
interactively. I use the following method:




dump.frames.mod = function() {
   dump.frames(dumpto = 'test', to.file = TRUE)
   quit(save = 'no', status = 10)
}

options(error = dump.frames.mod)


Is there any way to acess the content of the global environment from the 
*.rda file created in case of an error?

When I run the following, for example, I would like to access the 
contents of a,b and c from the debugging file:



dump.frames.mod = function() {
   dump.frames(dumpto = 'test', to.file = TRUE)
   quit(save = 'no', status = 10)
}

options(error = dump.frames.mod)


#uncomment with care:
#rm(list=ls())
a = 2
source('testscript.R', local = TRUE)

load('test.rda')
debugger(test)


testscript.R in this testcase contains:

b = 2
c = 3
plot(d)


The only way I found is wrapping a function around the lines of code but 
this would mean changing a lot of code.


Any Ideas?


Cheers
Jannis


 > sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-unknown-linux-gnu (64-bit)



More information about the R-help mailing list