[R] File path expansion
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon May 28 11:50:44 CEST 2007
On Mon, 28 May 2007, Martin Maechler wrote:
>>>>>> "Duncan" == Duncan Murdoch <murdoch at 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
More information about the R-help
mailing list