Re: [R] File path expansion

From: Martin Maechler <>
Date: Mon, 28 May 2007 11:44:28 +0200

>>>>> "Duncan" == Duncan Murdoch <> >>>>> on Fri, 25 May 2007 15:38:54 -0400 writes:

    Duncan> 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.
    Duncan> A more basic problem is that the definition of "~"
    Duncan> in Windows is very ambiguous.  Is it my Cygwin home
    Duncan> directory, where "cd ~" would take me while in
    Duncan> Cygwin?  

most probably not (see below). The normal R Windows users needn't know about Cygwin.

    Duncan> Is it my Windows CSIDL_PERSONAL folder,
    Duncan> usually %HOMEDRIVE%/%HOMEPATH%/My Documents?  Is it
    Duncan> the parent of that folder, %HOMEDRIVE%/%HOMEPATH%?

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

Let's just say "~" is a short cut for
"The user's home directory".
And yes, that's been a Unix concept for ages, but I think Windows had adopted that concept, probably with the above %HOMEDRIVE%/%HOMEPATH% The fact that some of windows software may not "work with" the user's home directory (but rather a subdirectory of that), may be a separate issue, but then, "I'm the windows-non-expert"

Martin Maechler mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 28 May 2007 - 09:50:42 GMT

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 Mon 28 May 2007 - 10:31:16 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.