Hi,

One of the functions I use needs to write to a temporary file, in the directory given by tempdir(). I want to change this from the standard one, as the file is too large for the drive. However, tempfile() doesnt seem to respect the environment variables when I change them with Sys.setenv(). In a fresh R-session:

> Sys.getenv("TMP")
[1] "C:\\Users\\skoiejo\\AppData\\Local\\Temp"
>  Sys.setenv(TMP = "e:\\Temp\\Rtmp")
> Sys.getenv("TMP")
[1] "e:\\Temp\\Rtmp"
>  tempfile()
[1] "C:\\Users\\skoiejo\\AppData\\Local\\Temp\\Rtmp2tvQ7U\\file499a5987"
# I have also tried to change "TMPDIR", "TEMP" and "R_USER", all with the same result.

# The directory is writable:
> write("some text", file = paste(Sys.getenv("TMP"),"test.txt",sep = ""))
> list.files(Sys.getenv("TMP"))
[1] "test.txt"

I have probably misunderstood something, but what? Session info below.

> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252

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

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

I know this is not the last version, but I do not have administrator rights myself on the computer and did not see any relevant references to tempfile() in the news for newer versions.

Thanks,
Jon

--
Jon Olav Skøien
Joint Research Centre - European Commission
Institute for Environment and Sustainability (IES)
Land Resource Management Unit

Via Fermi 2749, TP 440,  I-21027 Ispra (VA), ITALY

jon.sko...@jrc.ec.europa.eu
Tel:  +39 0332 789206

Disclaimer: Views expressed in this email are those of the individual and do 
not necessarily represent official views of the European Commission.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to