[R] Suggestion: Re: Fatal error .RData
Duncan Murdoch
murdoch at stats.uwo.ca
Thu Sep 18 18:21:08 CEST 2008
On 18/09/2008 12:13 PM, Henrik Bengtsson wrote:
> Hi.
>
> On Thu, Sep 18, 2008 at 8:16 AM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
>> On 18/09/2008 10:55 AM, Henrik Bengtsson wrote:
>>> R-core, may I suggest that the error message returns the absolute path
>>> (or even the relative path) and not just the filename/basename, e.g.
>>>
>>> "Fatal error: unable to restore saved data in C:/Users/foo/.RData"
>> That's a good suggestion, but unfortunately not quite trivial: the code
>> that prints that message has no idea what the full filename is. On Unix, R
>> just tries to open ".Rdata" without ever expanding the name, and on Windows,
>> the full name is stored in a place that this code can't see.
>>
>> So it's not impossible to fix this, but it would take some rearrangement of
>> things. I'm busy on other things so I'm not going to volunteer to do it.
>
> Curious: I'm not sure I get it (and I'm sure the code has the
> answer), but to open any file (on a file system) there must be a
> filename. I understand the case when you open a connection and then
> pass the connection to another function where the a error occur, but
> here it seems to know that the name is '.RData', or is that just
> hardwired in the error message?
Yes, it's hardwired.
Are you saying that only then name is
> passed by the path is unknown? If R code, then the outer function
> can use tryCatch() to catch errors.
This is part of the C code running while R is being initialized.
>
> If all this is implemented in cross platform R code, I can have a look
> at it. What functions are involved here?
setup_Rmainloop in main.c prints the message, the name is stored in
workspace_name, a static global variable hidden in startup.c. The
easiest approach would be to add a get_workspace_name function, but C is
so poor in handling functions returning strings that I can't be bothered.
Duncan Murdoch
More information about the R-help
mailing list