.Rprofile results in corruption of .RData? (PR#346)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
28 Nov 1999 00:00:52 +0100


Rashid Nassar <rnassar@duke.edu> writes:

> Here is a minimum set of instructions to reproduce the problem on my 
> computer:
> 
> 1. remove/rename any .Rprofile in home or current directories.
> 
> 2. rename .RData file
> 
> 3. copy Rprofile (the "original" Rprofile that came with R-0.90 when R was
>    untarred/compiled/installed) to the home directory.
> 
> 4. rename ~/Rprofile to ~/.Rprofile.  
> 
> (I'm trying to ensure that neither of my existing .Rprofile and .RData files 
> are involved in the test, and that only the "distribution" Rprofile, when 
> copied to the home directory and renamed to .Rprofile is the trigger for 
> the problem, i.e. simply the existence of a valid .Rprofile file)
> 
> 5. Run R, then q() and save .RData  (or save.image() and then quite 
> without further saving upon quitting.)  (It makes no difference if you did 
> anything within R, or whether you simply saved an 'empty' file)
> 
> 6. Run R again.  It cannot read .RData and aborts.
> 
> 7. Remove .Rprofile and .RData and run, quit (to make a new .RData) and 
> run it again, and it works perfectly.

OK, I think I see it.

(a) You're not supposed to do that! The system Rprofile is always
executed, so personal .Rprofile files should just contain your own
modifications.

(b) It boils down to the single line:

.AutoloadEnv <- pos.to.env(2)

and I suspect that the trouble is that it contains a pointer to something
on the search path which is not getting saved along with the
workspace. You can create the problem entirely without Rprofile like
this:

> x<-pos.to.env(2)
> save("x",file="junk")
> load("junk")
Error in load("junk") : unresolved node during restore
> rm(x)
> load("junk")
Error in load("junk") : unresolved node during restore
> ls()
character(0)

Looks more than a bit nasty to fix....

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._