[R] File path expansion

Duncan Murdoch murdoch at stats.uwo.ca
Fri May 25 21:38:54 CEST 2007


On 5/25/2007 1:09 PM, Prof Brian Ripley wrote:
> On Fri, 25 May 2007, Martin Maechler wrote:
> 
>>
>>> path.expand("~")
>> [1] "/home/maechler"
> 
> Yes, but beware that may not do what you want on Windows in R <= 2.5.0, 
> since someone changed the definition of 'home' but not path.expand.

A more basic problem is that the definition of "~" in Windows is very 
ambiguous.  Is it my Cygwin home directory, where "cd ~" would take me 
while in Cygwin?  Is it my Windows CSIDL_PERSONAL folder, usually 
%HOMEDRIVE%/%HOMEPATH%/My Documents?  Is it the parent of that folder, 
%HOMEDRIVE%/%HOMEPATH%?

"~" is a shell concept that makes sense in Unix-like shells, but not in 
Windows.

Duncan Murdoch



More information about the R-help mailing list