[R] save.image() error

Marc R. Feldesman feldesmanm at pdx.edu
Sun Apr 7 18:21:03 CEST 2002

At 04:25 AM 4/7/2002, ripley at stats.ox.ac.uk wrote:
 >On Sat, 6 Apr 2002, Marc R. Feldesman wrote:
 >> Running 1.4.1 (Windows) under Windows XP Pro.  Have had no difficulty for
 >> several weeks since moving to the new OS.  Today, while checking the
 >> behavior of my mouse, I loaded Rgui as usual.  I then immediately tried to
 >> exit the program.  Upon exiting, I got the following message:
 >> Error in save.image(name) : image could not be renamed and is left in
 >> I can move the .RData file to any other machine and use it without
 >> difficulty, which suggests that the file itself is not corrupt.  Since I
 >> didn't do anything (that I'm aware of) to precipitate this error -- I
 >> haven't installed or updated any packages for a few weeks -- I'm a bit
 >> baffled by the error.
 >> What is its cause and what are the suggested "cures".
 >R 1.4.x saves the image as a temporary file, and then renames it to
 >.RData.  This is a precaution against wiping out a saved workspace
 >and then being unable to write out the current workspace, say from lack of
 >file space.
 >This mechanism can be over-ridden: see ?save.image.
 >In your case file.rename has failed.  Now file-renaming works better
 >on Unix than on Windows, and if Windows has the file open (or thinks it
 >has) it cannot be renamed.  So if you did this immediately, before the
 >command prompt had come up, from the menu or x button, you might get
 >a race condition.  (I've tried to reproduce that, but I can't even on my
 >slowest machine.)  It's not unknown for Windows to get confused and
 >need to be re-started (log out and in again on NT/2000/XP) to allow
 >files to be deleted.
 >The only known problems with using XP Pro are colour schemes (which are
 >not used as documented in even the latest SDK), and the need for a
 >manifest to get the XP version of the common controls (and there is one on
 >CRAN).  Both are resolved in R-devel, 1.5.0-to-be.

The "fix" in ?save.image solves the problem, but this seems to be a 
definite *issue* with Windows XP Pro.  I took the identical .RData file 
from the XP machine and moved it onto a machine with Windows NT 4, and two 
others running Windows 2000 Pro.  Neither of them evidence the problem 
"unfixed".  The XP Pro machine is a 2.2 GHz P4 running 1024 MB RAM and a 
120 GB Harddrive with about 100 GB free.  BTW, logging out of the XP box 
doesn't result in the temp files being erased.  Once created, I have to go 
in and manually delete them.

How is the behavior of "File|Save Image" different 
from >save.image("a.file.image.name")?  The former works without the "fix" 
while the latter fails unless I have the "fix" in place in the .RProfile

What is a "race" condition?


r-help 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-help-request at stat.math.ethz.ch

More information about the R-help mailing list