[R] Linking in R package documentation

Duncan Murdoch murdoch at stats.uwo.ca
Sun Aug 9 21:45:06 CEST 2009


Rebecca Sela wrote:
> I have two straightforward questions about linking in the man pages for R packages:
>
> First, is it possible to link from within parts of the documentation that are not the \seealso section?  For example, I would like to have something like:
> \arguments{
>   \item{correlation}{an optional \code{corStruct} object describing the within-group correlation structure; the available classes are given in \link{\code{corClasses}}}
> }
>   

Yes, you can put \link anywhere.  But you should put things in the other 
order:  \code{\link{corClasses}}, or the link won't work.
> When the package is compiled, the word corClasses is blue and underlines, but nothing happens when you click on it.  
>
> Second, how do I link to a function of the same name in another package?  I thought I could use something like:
> \seealso{\code{\link[nlme]{ranef}}}
> but that gives a Page Not Found.  
>   

That's close.  The trouble is that linking is slightly inconsistent in 
how it goes across packages:  you can't link to an alias "ranef" the way 
you normally do, you need to link to the filename of the Rd file 
containing that topic (in this case "random.effects").  The reason for 
this is that in current R versions, all the links are built when the 
package is installed, and it may be that the package you refer to will 
be installed later:  so R can't look up the alias yet.  Hopefully we'll 
be able to relax this and allow alias links in a near future version of 
R, maybe even 2.10.0, because there are major changes happening to the 
implementation of the help system.  In at least HTML help, for example, 
it's likely that the alias "ranef" will be resolved at the time you 
click on the link.  At that point R can determine if you have nlme 
installed (which you almost certainly do), and look up the alias, to 
find the help page to display.

Duncan Murdoch
> Thank you in advance!
>
> Rebecca
>
> ______________________________________________
> R-help at r-project.org 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.
>




More information about the R-help mailing list