Re: [R] File path expansion
Duncan == Duncan Murdoch [EMAIL PROTECTED] 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. 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% 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 __ R-help@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.
Re: [R] File path expansion
On Mon, 28 May 2007, Martin Maechler wrote: Duncan == Duncan Murdoch [EMAIL PROTECTED] 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, [EMAIL PROTECTED] 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, UKFax: +44 1865 272595 __ R-help@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.
Re: [R] File path expansion
Try ?path.expand On 5/25/07, McGehee, Robert [EMAIL PROTECTED] wrote: R-Help, I discovered a mis-feature is ghostscript, which is used by the bitmap function. It seems that specifying file names in the form ~/abc.png rather than /home/directory/abc.png causes my GS to crash when I open the bitmap device on my Linux box. The easiest solution would seem to be to intercept any file names in the form ~/abc.png and replace the ~ with the user's home directory. I'm sure I could come up with something involving regular expressions and system calls to do this in Linux, but even that might not be system independent. So, I wanted to see if anyone knew of a native R solution of converting ~ to its full path expansion. Thanks, Robert __ R-help@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. __ R-help@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.
Re: [R] File path expansion
path.expand(~) [1] /home/maechler RobMcG == McGehee, Robert [EMAIL PROTECTED] on Fri, 25 May 2007 11:44:27 -0400 writes: RobMcG R-Help, RobMcG I discovered a mis-feature is ghostscript, which is used by the bitmap RobMcG function. It seems that specifying file names in the form ~/abc.png RobMcG rather than /home/directory/abc.png causes my GS to crash when I open RobMcG the bitmap device on my Linux box. RobMcG The easiest solution would seem to be to intercept any file names in the RobMcG form ~/abc.png and replace the ~ with the user's home directory. I'm RobMcG sure I could come up with something involving regular expressions and RobMcG system calls to do this in Linux, but even that might not be system RobMcG independent. So, I wanted to see if anyone knew of a native R solution RobMcG of converting ~ to its full path expansion. RobMcG Thanks, RobMcG Robert __ R-help@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.
Re: [R] File path expansion
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. RobMcG == McGehee, Robert [EMAIL PROTECTED] on Fri, 25 May 2007 11:44:27 -0400 writes: RobMcG R-Help, RobMcG I discovered a mis-feature is ghostscript, which is used by the bitmap RobMcG function. It seems that specifying file names in the form ~/abc.png RobMcG rather than /home/directory/abc.png causes my GS to crash when I open RobMcG the bitmap device on my Linux box. RobMcG The easiest solution would seem to be to intercept any file names in the RobMcG form ~/abc.png and replace the ~ with the user's home directory. I'm RobMcG sure I could come up with something involving regular expressions and RobMcG system calls to do this in Linux, but even that might not be system RobMcG independent. So, I wanted to see if anyone knew of a native R solution RobMcG of converting ~ to its full path expansion. RobMcG Thanks, RobMcG Robert __ R-help@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. -- Brian D. Ripley, [EMAIL PROTECTED] 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, UKFax: +44 1865 272595 __ R-help@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.
Re: [R] File path expansion
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 __ R-help@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.