[R] content of global environment with dump.frames()

Jannis bt_jannis at yahoo.de
Fri Nov 25 01:11:31 CET 2011


On 11/24/2011 07:02 PM, R. Michael Weylandt wrote:
> Are perhaps you looking for options(error = recover)?
>
> Michael

No, not really. First I use this for non-interactive sessions (otherwise 
I would mtrace() from package debug) and second I also want to save and 
retrieve the environment contents in case there is no error which causes 
R to stop.

Thanks, however, for your reply!

Jannis


>
> On Thu, Nov 24, 2011 at 12:52 PM, Jannis<bt_jannis at yahoo.de>  wrote:
>> Dear R users,
>>
>>
>> I am using dump.frames() to investigate the content of the different environments in cases of errors or during certain steps of a non interactive calculation. I am, however, wondering about how to see the content of the global environment at the moment that dump.fames() was invoked. Her is some test piece (careful about the rm(list=ls(), remove the # if you know what you are doing to easier see the effect):
>>
>> # rm(list=ls())
>> a=2
>> test = function() {
>>    b=3
>>    dump.frames(dumpto='test', to.file = TRUE )
>> }
>> test()
>> # rm(list=ls())
>> load('test.rda')
>> debugger(test)
>>
>> I can now investigate the value of 'b' but could not figure out a way to get the value of 'a'. Am I missing something or is dump.frames only intended to be uses with
>>
>>
>> options(error=dump.frames)
>>
>>
>> ? Most probably some modification of save() would be more apropriate to use in my case but I could not (yet) figure out how to mimic the convenient behaviour of dump.frames() to save the whole call stack.
>>
>>
>>
>>
>> Thanks for any advice
>> Jannis
>>
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list