tempdir() does not respect TMPDIR
It is too late to set TMPDIR in .Renviron. It is one of the
environment variables that has to be set prior to launching R. From
help("tempfile", package = "base"):
The environment variables TMPDIR, TMP and TEMP are checked in turn and
the first found which points to a writable directory is used: if none
succeeds ?/tmp? is used. The path should not contain spaces. **Note
that setting any of these environment variables in the R session has
no effect on tempdir(): the per-session temporary directory is created
before the interpreter is started.**
/Henrik
On Sat, Aug 29, 2020 at 6:40 AM Jinsong Zhao <jszhao at yeah.net> wrote:
Hi there, When I started R by double clicking on Rgui icon (I am on Windows), the tempdir() returned the tmpdir in the directory I set in .Renviron. If I started R by double clicking on a *.RData file, the tempdir() return the tmpdir in the directory setting by Windows system. I don't know whether it's designed.
> sessionInfo()
R version 4.0.2 (2020-06-22) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363) ... Best, Jinsong
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.