Re: [R] File path expansion

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon, 28 May 2007 10:50:44 +0100 (BST)

On Mon, 28 May 2007, Martin Maechler wrote:

>>>>>> "Duncan" == Duncan Murdoch <murdoch@stats.uwo.ca>
>>>>>> 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.

And a Unix-alike should have HOME set, and that overrides everything else on R for Windows, so probably yes if running from a Unix-alike shell.

> 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.
>
> Hmm..
> 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%
We do explain in the rw-FAQ what R thinks the 'home directory' is on Windows. My comment was that had been altered, and path.expand was not altered to follow. Duncan M suggests that was uninportant, but I thought it worth fixing.

> 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
>

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 28 May 2007 - 09:57:18 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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.