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
Convert Data.Frame Column to a Vector
How to Tell Lapply to Ignore an Error and Process the Next Thing in the List
Replace Negative Values by Zero
Why Does R Use Partial Matching
Disable Messages Upon Loading a Package
Ggplot Separate Legend and Plot
Replacing Numbers Within a Range with a Factor
How to Add Table of Contents in Rmarkdown
Element-Wise Mean Over List of Matrices
Is There a R Function That Applies a Function to Each Pair of Columns
Dynamically Build Call for Lookup Multiple Columns
R Apply Function with Multiple Parameters
Linear Regression "Na" Estimate Just for Last Coefficient
R Convert Zipcode or Lat/Long to County
Add New Row to Dataframe, at Specific Row-Index, Not Appended