rtempdir

Change temporary directory


I am using R on windows and need to change the temporary directory where tmp files are stored.

I checked a few answers, here, in R-help, etc., but no one is working.

Some links I tried: here, here, and here.

After trying those answers (I have to say that I do not get exactly the point on them), tempdir() still is the default, as much as I try different ways.

Can anybody can give a detailed example procedure of how to do this?

My session Info:

R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_2.15.2

Solution

  • Create a file called .Renviron in the directory given by Sys.getenv('R_USER') and save it with the line TMP = '<your-desired-tempdir>'.

    write("TMP = '<your-desired-tempdir>'", file=file.path(Sys.getenv('R_USER'), '.Renviron'))