Re: [Rd] Limitation of dirname() and basename(): file.name() and file.dir() ?

2007-03-28 Thread cstrato
I am glad to hear that there seems to be some commitment for improvement, although I must admit, that I did not realize that both functions do not check if a name is a directory or a filename, even though the definition in "The Open Group Base Specifications" says: dirname - return the direct

Re: [Rd] Limitation of dirname() and basename()

2007-03-27 Thread Simon Urbanek
On Mar 27, 2007, at 5:42 PM, Herve Pages wrote: > Simon Urbanek wrote: >> Your proposed behavior is inconsistent, anyway. The purpose of >> dirname is to return parent directory of the entity represented by >> the pathname. > > Mmmm, I don't think this is true: > >> dirname("aaa/..") > [1]

Re: [Rd] Limitation of dirname() and basename()

2007-03-27 Thread cstrato
Simon Urbanek wrote: > > On Mar 27, 2007, at 2:49 PM, cstrato wrote: > >> Hin-Tak Leung wrote: >>> cstrato wrote: 1. I did read the help file. 2. I have my own workaround, using e.g. file.info("/my/path/")[,"isdir"] 3. This was a suggestion. 4. If you agree with me that "/m

Re: [Rd] Limitation of dirname() and basename()

2007-03-27 Thread Herve Pages
Hi, Simon Urbanek wrote: > Your proposed behavior is inconsistent, anyway. The purpose of > dirname is to return parent directory of the entity represented by > the pathname. Mmmm, I don't think this is true: > dirname("aaa/..") [1] "aaa" "aaa" is not the parent directory of "aaa/.." S

Re: [Rd] Limitation of dirname() and basename()

2007-03-27 Thread Simon Urbanek
On Mar 27, 2007, at 2:49 PM, cstrato wrote: > Hin-Tak Leung wrote: >> cstrato wrote: >>> 1. I did read the help file. >>> 2. I have my own workaround, using e.g. >>> file.info("/my/path/")[,"isdir"] >>> 3. This was a suggestion. >>> 4. If you agree with me that "/my/path/" is a path, then both >>

Re: [Rd] Limitation of dirname() and basename()

2007-03-27 Thread cstrato
Gabor Grothendieck wrote: > On 3/27/07, cstrato <[EMAIL PROTECTED]> wrote: >> Hin-Tak Leung wrote: >> > cstrato wrote: >> >> 1. I did read the help file. >> >> 2. I have my own workaround, using e.g. >> >> file.info("/my/path/")[,"isdir"] >> >> 3. This was a suggestion. >> >> 4. If you agree with m

Re: [Rd] Limitation of dirname() and basename()

2007-03-27 Thread Gabor Grothendieck
On 3/27/07, cstrato <[EMAIL PROTECTED]> wrote: > Hin-Tak Leung wrote: > > cstrato wrote: > >> 1. I did read the help file. > >> 2. I have my own workaround, using e.g. > >> file.info("/my/path/")[,"isdir"] > >> 3. This was a suggestion. > >> 4. If you agree with me that "/my/path/" is a path, then

Re: [Rd] Limitation of dirname() and basename()

2007-03-27 Thread cstrato
Hin-Tak Leung wrote: > cstrato wrote: >> 1. I did read the help file. >> 2. I have my own workaround, using e.g. >> file.info("/my/path/")[,"isdir"] >> 3. This was a suggestion. >> 4. If you agree with me that "/my/path/" is a path, then both >>"dirname()" and "dirname" give an incorrect an

Re: [Rd] Limitation of dirname() and basename()

2007-03-27 Thread Hin-Tak Leung
cstrato wrote: > 1. I did read the help file. > 2. I have my own workaround, using e.g. >file.info("/my/path/")[,"isdir"] > 3. This was a suggestion. > 4. If you agree with me that "/my/path/" is a path, then both >"dirname()" and "dirname" give an incorrect answer. > 5. Maybe, you can giv

Re: [Rd] Limitation of dirname() and basename()

2007-03-27 Thread cstrato
1. I did read the help file. 2. I have my own workaround, using e.g. file.info("/my/path/")[,"isdir"] 3. This was a suggestion. 4. If you agree with me that "/my/path/" is a path, then both "dirname()" and "dirname" give an incorrect answer. 5. Maybe, you can give me a logical reason (beside

Re: [Rd] Limitation of dirname() and basename()

2007-03-26 Thread Prof Brian Ripley
These functions work as they should: did you not read the help page which explicitly tells you what happens in this case? The Unix originals work in the same way: gannet% dirname /my/path/ /my Please DO study the R posting guide and do the homework requesting of you before posting. On Mon, 26

[Rd] Limitation of dirname() and basename()

2007-03-26 Thread cstrato
Dear all, I have already twice encountered a case which I consider a limitation of dirname() and basename(). In my functions I have a parameter "outfile" which e.g. tells where a file should be stored. Usually "outfile" is of the form: oufile = "/my/path/myname.txt" > outfile <- "/my/path/mynam