Skip to content
Prev 385504 / 398506 Next

tempdir() does not respect TMPDIR

Sorry, I should retract my claim that it's too late to set TMPDIR in
.Renviron.  It does indeed work on Linux and R 4.0.2, e.g.

$ cd
$ mkdir test
$ cd test
$ echo "TMPDIR=$PWD" > ./.Renviron
$ cat ./.Renviron
TMPDIR=/home/hb/test
Rscript --no-init-file -e "tempdir()"
[1] "/home/hb/test/RtmpyH47tc"

Hmm... either this has changed "recently" or I've got it wrong all the
time.  Eitherway, I need to revise the vignette in my 'startup'
package.

Sorry for the misleading comment.

So, back to your comment about it does *not* work, that is,
~/.Renviron is not read, when you double-click on an .RData file.  I
just tried with R 4.0.2 in a Windows 10 VM and I think I can reproduce
what you're describing.

The problem seems to be that when one launches Rgui via
double-clicking .RData, the Rgui will only read ./.Renviron, that is,
the .Renviron file that is located in the same folder as the .RData
file.  It will never load ~/.Renviron (e.g.
C:/Users\alice/Documents/.Renviron) unless the .RData file is in that
folder too.

This looks odd to me but it could be that I made another mistake in my
conclusions above.  I let someone else with a less mushy brain take
over from here.

/Henrik
On Sat, Aug 29, 2020 at 4:31 PM Jinsong Zhao <jszhao at yeah.net> wrote: