Re: [Rd] tempdir() documentation or real bug ?

From: Simon Urbanek <simon.urbanek_at_r-project.org>
Date: Tue, 21 Feb 2012 14:50:18 -0500

On Feb 21, 2012, at 2:20 PM, Brian G. Peterson wrote:

> ?tempdir says
>
> By default, ‘tmpdir’ will be the directory given by ‘tempdir()’.
> This will be a subdirectory of the temporary directory found by
> the following rule. 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.
>
>
> Unfortunately, it doesn't seem to work as advertised.
>

It does - you are just setting the environment variable too late - the temporary directory is determined at R startup:

$ TMPDIR=/Users/urbanek R --slave -e 'print(tempdir())' [1] "/Users/urbanek/RtmpDee89D"

Cheers,
Simon

>> Sys.setenv(TMPDIR='/home/brian/')
>> Sys.getenv('TMPDIR')

> [1] "/home/brian/"
>> tempdir()

> [1] "/tmp/RtmpfERGay"
>
>
>> Sys.setenv(TEMP='/home/brian/')
>> Sys.getenv('TEMP')

> [1] "/home/brian/"
>> tempdir()

> [1] "/tmp/RtmpfERGay"
>
>
>> Sys.setenv(TMP='/home/brian/')
>> Sys.getenv('TMP')

> [1] "/home/brian/"
>> tempdir()

> [1] "/tmp/RtmpfERGay"
>
>
> Our /tmp/ directory is not very large, so I'd like to create tempdir()'s
> in someplace that has space.
>
> Regards,
>
> - Brian
>
> --
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 21 Feb 2012 - 19:58:58 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 21 Feb 2012 - 22:30:19 GMT.

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

list of date sections of archive