From ripley at stats.ox.ac.uk  Sat Oct 17 19:57:38 2009
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sat, 17 Oct 2009 18:57:38 +0100 (BST)
Subject: [Rd] linking to package directories is NOT broken in R >= 2.10
 beta
In-Reply-To: <4AD9BB1E.5010408@TU-Dresden.de>
References: <4AD9BB1E.5010408@TU-Dresden.de>
Message-ID: <alpine.LFD.2.00.0910171712200.16276@gannet.stats.ox.ac.uk>

When you linked to ../examples/ R was not involved, and what you are 
seeing is what your browser did with a file:// url.  Most browsers 
will support a wide range of file types, and list directories: but 
that is not something that was ever (AFAICS) documented to work.

The 'issue' is your expectations when creating your own 
inst/doc/index.html.  The only relative links that are supported by 
the help system are to R package help topics and files, to 
documentation under R.home("doc") and a limited set of files in a 
package's 'doc' directory to support its use for vignettes, including 
the ability to list 'doc' itself (if requested in a particular way).

If links to files under <pkg>/example worked, it was a bug. Because of 
security concerns over traffic snooping, what you can see through the 
dynamic help system is intentionally very limited.  In fact I suspect 
they worked for you only because

(i) you installed into .Library
(ii) you had a file for which text/plain worked (and that is because 
files that might be in a vignette directory have been checked)..
(iii) you fell into a code branch marked '# should not get here' in 
pre-2.10.0 (but absent in R-devel).

The good news is that if you refer to files under the installed 'doc' 
directory this should work -- subdirectory listings work now in 
R-devel and will probably be ported to 2.10.0 before release.


On Sat, 17 Oct 2009, Thomas Petzoldt wrote:

> Dear R developers,
>
> some of our packages come with additional programming examples in a directory 
> called "/examples" which is created from "/inst/examples".
>
> This directory is linked from the docs (e.g. in inst/doc/index.html):
>
> <dl>
> <dt><a href="../examples/">examples</a>:
> <dd>Source code of examples
> </dl>
>
> Given, that we have a package "foo" this is resolved to:
>
> file:///C:/Programme/R/R-2.9.2/library/foo/examples/
>
> with R <= 2.9.2. With R 2.10 beta (R-beta_2009-10-16_r50118.tar.gz) and 
> R-devel (svn rev. 50118) we get:
>
> http://127.0.0.1:26383/library/foo/examples/
>
> This is fine, but in contrast to older versions (<= 2.9.2) no automatic index 
> is created for the linked directory, so we now get:
>
> "URL /library/foo/examples/ was not found"
>
> bu linking to *individual files* (e.g. examples/example.R) works as expected. 
> We can, of course, add manually maintained index files but I would much 
> prefer if a default index would be created for the directory if no index.html 
> is found.
>
> I very much enjoy the new help system and would be even more happy if that 
> issue could be fixed.
>
> Thomas Petzoldt
>
>
> PS: A minimal reproducible example (foo_1.0.tar.gz) can be provided by mail 
> if required.
>
> -- 
> Thomas Petzoldt
> Technische Universitaet Dresden
> Institut fuer Hydrobiologie        thomas.petzoldt at tu-dresden.de
> 01062 Dresden                      http://tu-dresden.de/hydrobiologie/
> GERMANY
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
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



[Rd] linking to package directories is NOT broken in R >= 2.10 beta
Prof Brian Ripley