Change Temporary Directory

Change temporary directory

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'))

How to change directory for temporary files - problems with huge temporary raster files

I got to the right answer:

 write("TMPDIR = D:/rtmp/", file=file.path(Sys.getenv('TMPDIR'), '.Renviron'))
write("R_USER = D:/rtmp/", file=file.path(Sys.getenv('R_USER'), '.Renviron'))

This changes even the temp-directory of the writeRaster() function

UPDATE:

for those of you, who might have trouble with this error (due to limited permissions)

> write("TMPDIR = D:/rtmp/", file=file.path(Sys.getenv('TMPDIR'), '.Renviron'))
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file '/.Renviron': Permission denied

i found that

rasterOptions(tmpdir = "D:/rtmp/")
write("R_USER = D:/rtmp/", file=file.path(Sys.getenv('R_USER'), '.Renviron'))

also solves the issue.

Change temporary directory in Rails 4

It seems that some libraries like to hard code values... See: [1]

By adding the following you can get around the hard coded value:

  config.assets.cache_limit = 50.megabytes

config.assets.configure do |env|
env.cache = Sprockets::Cache::FileStore.new(
File.join(ENV['RAILS_TMP'], 'cache/assets'),
config.assets.cache_limit,
env.logger
)
end

Change tempdir() in session (update R_TempDir)

Update: Simon Urbanecks unixtools package has a function to accomplish this. Below the code (for future reference).

set.tempdir <- function(path) {
invisible(.Call(C_setTempDir, path.expand(path)))
}

C code:

#include <string.h>
#include <Rinternals.h>
#include <Rembedded.h>

SEXP C_setTempDir(SEXP sName) {
if (TYPEOF(sName) != STRSXP || LENGTH(sName) != 1)
Rf_error("invalid path");
R_TempDir = strdup(CHAR(STRING_ELT(sName, 0)));
return sName;
}

Change temporary file directory in SAS

You want to change the WORK system option. You can do:

c:\sas\sas.exe -work d:\temp

to use the d:\temp directory.

You can also use the OPTIONS statement within the config file used when starting SAS (thanks Tom):

options work='d:\temp'

See also:

  • Indiana University answer for SAS on UNIX systems.
  • SAS 9.2 documentation on system options.


Related Topics



Leave a reply



Submit