Re: [R] Problem setting TMPDIR on the fly

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Mon 30 Oct 2006 - 16:33:09 GMT

"Benjamin Lloyd-Hughes" <Benjamin.Lloyd-Hughes@benfieldgroup.com> writes:

> Hi folks,
>
>
>
> I'm having a spot of bother with tempdir(). If I set the environment
> variable TMPDIR in my shell prior to invoking R it works as expected:
>
>
>
> > Sys.getenv("TMPDIR")
>
> TMPDIR
>
> "/eurotempest/tmp/R"
>
> > tempdir()
>
> [1] "/eurotempest/tmp/R/Rtmp0xY4XD"
>
>
>
> However if I don't set it prior to entry, but attempt to set it from
> within the current session, the change is not detected/respected:
>
>
>
> > Sys.getenv("TMPDIR")
>
> TMPDIR
>
> ""
>
> > Sys.putenv(TMPDIR = "/eurotempest/tmp/R/")
>
> > Sys.getenv("TMPDIR")
>
> TMPDIR
>
> "/eurotempest/tmp/R/"
>
> > tempdir()
>
> [1] "/tmp/Rtmp9chsNX"
>
>
>
> Any ideas?

You're not supposed to do that. There is one and only one tempdir per R session. This is used for storing stuff which R expects to be able to find again later, so it would be a bad thing just to switch it out.

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch 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.
Received on Tue Oct 31 03:44:09 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 30 Oct 2006 - 17:30:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.