Skip to content
Prev 174103 / 398506 Next

How do I set the Windows temporary directory in R?

As far as I know setwd() does not influence where temporay files (TMPDIR,
TMP, TEMP) are located - at least not for me on windows vista.
As mentioned before setting environment variable should work.
Also I carry R on a USB, so I don't want temporary files being written to
the PC / laptop where I connect or downloaded packages for that matter.
I use a Renviron.site file to make sure files are saved where I want them
(Renviron.site sits in the "etc" folder of the R install files).

and contains the following specifications (this works for me but can't
guarantee it is good / recommended practice - for example I need to change
directory "M" to match where I plug USB in ) and I created the folders
specified, I don't know if R will create them if it doesn't find them:

HOME=M:/
R_USER=M:/
R_LIBS_USER=M:/myRlib
TMPDIR=M:/myRtmp
TMP=M:/myRtmp
TEMP=M:/myRtmp

HTH
Darren
stephen sefick wrote: