[Rd] tempdir() in R-2.2.1 under Windows

J. Hosking jh910 at juno.com
Mon Jan 16 00:02:21 CET 2006


The documentation for tempdir() and tempfile() on R-2.2.1 for Windows
says that "Both will use backslash as the path separator", but in
practice I see a forward slash:

  > tempdir()
  [1] "C:\\DOCUME~1\\ADMINI~1\\LOCALS~1\\Temp/RtmpGqB7ob"
  > tempfile()
  [1] "C:\\DOCUME~1\\ADMINI~1\\LOCALS~1\\Temp/RtmpGqB7ob\\file6df11649"

This causes problems when the string is passed as a parameter to a
Windows program that accepts only backslash as a path separator.
For example, fix() appears to pass the tempfile() string to the
editor program and my preferred editor (KEDIT) does not accept it:
I get an error message "Invalid fileid" from KEDIT and a warning from
fix() "Warning message: editor ran but returned error status in:
edit(name, file, title, editor)".  I can work around this with
fix(object,file=normalizePath(tempfile())), but I would rather have
tempfile() return a normalized path in the first place.

 > R.version
          _
platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
status
major    2
minor    2.1
year     2005
month    12
day      20
svn rev  36812
language R


J. R. M. Hosking



More information about the R-devel mailing list