Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Rd links to suggested package [closed]

My hyperSpec package provides functions to work with spectoscopic data sets. I provide hyperSpec-methods for quite a number of functions coming from other packages. However, some of these other packages, I have listed as Suggests: as I do not want to force users to install something like 20 other packages (counting dependencies) if they may never use the specific functionality.

From the coding point of view, that works nicely. However, I'm at a loss how to deal with that in the .Rd file - but I'm sure it is a rather common problem.

The usual \code{\link[otherpkg]{fun}} will not reliably work, as there is no guarantee that otherpkg is available. If otherpkg is not installed, then the link is broken. That will be detected by R CMD check e.g. on Winbuilder and r-forge. Which means: the package won't pass CRAN checks.

Which packages would be a good example to look at?

The only hint (though no solution) I found so far: https://stat.ethz.ch/pipermail/r-devel/2009-November/055425.html (but there was no answer to that email).

like image 495
cbeleites unhappy with SX Avatar asked Aug 21 '12 15:08

cbeleites unhappy with SX


2 Answers

The Cross-References section of Writing R Extensions says that to link to other packages use

\link[otherpkg]{foo}

with the tricky / inscrutable thing being that foo is the name of the html help page that you want to link to (within a package, there would be no need for [mypkg] and foo would be an \alias in another man page). The name of the help page is determined by the \name directive in the Rd file defining the help you're interested in retrieving.

like image 69
Martin Morgan Avatar answered Oct 21 '22 08:10

Martin Morgan


In the end, I made otherpkg a dependency.

like image 42
cbeleites unhappy with SX Avatar answered Oct 21 '22 08:10

cbeleites unhappy with SX