[R] How do I set the Windows temporary directory in R?

Steven McKinney smckinney at bccrc.ca
Wed Mar 18 03:19:48 CET 2009

Check help for tempfile() and tempdir()

You can set an environment variable
as discussed in the help
to point to D:\temp

>From ?tempfile:
 By default, the filenames will be 
 in 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.


Steven McKinney, Ph.D.

Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

email: smckinney +at+ bccrc +dot+ ca

tel: 604-675-8000 x7561

Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C. 
V5Z 1L3

-----Original Message-----
From: r-help-bounces at r-project.org on behalf of Jonathan Greenberg
Sent: Tue 3/17/2009 6:42 PM
To: r-help at r-project.org
Subject: [R] How do I set the Windows temporary directory in R?
I'm trying to redirect where temporary files go under R to 
D:\temp\somerandomname from its default (C:\Documents and 
Settings\username\Temp\somerandomname) -- how do I go about doing this?



Jonathan A. Greenberg, PhD
Postdoctoral Scholar
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California, Davis
One Shields Avenue
The Barn, Room 250N
Davis, CA 95616
Cell: 415-794-5043
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list