[Rd] Limitation of dirname() and basename()
cstrato
cstrato at aon.at
Mon Mar 26 19:49:27 CEST 2007
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/myname.txt"
> dirname(outfile)
[1] "/my/path"
> basename(outfile)
[1] "myname.txt"
However, in addition I want to be able to define the path only, while
creating the name "myname.txt" automatically.
Sorrowly, I get the following:
> outfile <- "/my/path/"
> dirname(outfile)
[1] "/my"
> basename(outfile)
[1] "path"
It would be great if dirname() and basename() could recognize:
dirname("/my/path/") = /my/path/
basename(""/my/path/") = ""
i.e. they should be able to recognize a trailing "/".
Best regards
Christian
_._._._._._._._._._._._._._._._
C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
V.i.e.n.n.a A.u.s.t.r.i.a
_._._._._._._._._._._._._._._._
More information about the R-devel
mailing list