[R] fatal error unused tempdir

Duncan Murdoch murdoch at stats.uwo.ca
Thu Nov 3 17:37:33 CET 2005


On 11/3/2005 11:12 AM, SANDRINE COELHO wrote:
> Hello,
> 
> I am running R on XP Windows machine, and frequently I have enable to start R. I
> have this message: "Fatal Error: cannot find unused tempdir name". I don't know
> why.

This has come up before.  When R starts up, it tries to create a folder 
for temporary files, using the TMP, TEMP or R_USER environment variables 
(in that order) to find a base path.  The tempdir() function will tell 
you the folder name.

It chooses the name by appending a random number between 0 and 65535 to 
a base name.  It makes 100 attempts at this, and if it can't find a name 
that works, it bails out.  That's what you're seeing.  Sometimes it gets 
lucky and finds a name in the first 100 tries; then you don't get the 
error.

R tries to delete the directory when it quits, but if there are files 
there, deletion will fail.  So you should probably try to track down 
what is producing files and not getting rid of them.

What you need to do is to find the directory containing all these 
temporary files (print tempdir() on one of your successful attempts), 
and delete all the old ones.

Duncan Murdoch




More information about the R-help mailing list