On Fri, 3 Oct 2008, [EMAIL PROTECTED] wrote:

Full_Name: Enrico Pegoraro
Version: 2.7.2
OS: Windows (Vista or Xp PRO) Italian
Submission from: (NULL) (87.4.189.202)


If you send these lines of code:

outdir="c:/pippo"
file.path(outdir,"pluto.html")

R replies correctly:

[1] "c:/pippo/pluto.html"

But if you change the first steps to:

outdir=""
file.path(outdir,"pluto.html")

R replies (uncorrectly, I think)

[1] "/c:/pippo/pluto.html"

Not for me!  I get

outdir=""
file.path(outdir,"pluto.html")
[1] "/pluto.html"

which is as documented, hence correct. Furthermore, the code cannot possibly give your answer unless 'c:/pippo' has some special status on your system, and you haven't told us anything about that.

If you do

file.path("", "c:/pippo", "pluto.html")

you get what you indicate, but that is user error (an empty server/share specification).


This problem influence the R2HTML package too, which, if you send a line as:

targetHtml=HTMLInitFile(outdir="",filename="htmlFile",Title ="Title")

in windows it submit an error because of file.path() error.

It will affect any such misuse of file.path, of course. It really is not a good idea to use empty file path elements, especially on Windows[*]. If you mean the current directory, use ".".

[*] On Unix // is equivalent to /. On Windows \\ or // may have a special meaning (a share) or be regarded as invalid. A trailing / or \ can be disastrous.

Thank you
Enrico


--
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, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to