From simon.urbanek at r-project.org  Tue Feb 21 20:50:18 2012
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Tue, 21 Feb 2012 14:50:18 -0500
Subject: [Rd] tempdir() documentation or real bug ?
In-Reply-To: <1329852009.8901.175.camel@brian-rcg>
References: <CA+xi=qYgspXhS6hyNn_-p-ksMV-WrrkgzFYm2++qCR2rUii-8Q@mail.gmail.com>
	<1329509593.8901.116.camel@brian-rcg>
	<CA+xi=qbhnX+1rfuQ_iF_H=oeJSHWifTuEs8rcpiW8b7LSsYiXg@mail.gmail.com>
	<1329848378.8901.170.camel@brian-rcg>
	<CA+xi=qZia+=yDHXQgwmi_18raG-vig8KPpxPKVaTs-eXwBxUUw@mail.gmail.com>
	<CA+xi=qaCKDLLQWKJVgSe3z1xvntECH+_i0_zw9zqnj6C_uhcjQ@mail.gmail.com>
	<1329850135.8901.171.camel@brian-rcg>
	<1329852009.8901.175.camel@brian-rcg>
Message-ID: <39E1487B-5E63-4818-8399-D2ECFD604DA5@r-project.org>


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



[Rd] tempdir() documentation or real bug ?
Simon Urbanek