.Rd links to suggested package [closed]
Asked Answered
H

2

14

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

Hoopoe answered 21/8, 2012 at 15:28 Comment(0)
H
3

In the end, I made otherpkg a dependency.

Hoopoe answered 5/12, 2012 at 8:48 Comment(0)
A
6

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.

Alphonsa answered 21/8, 2012 at 16:34 Comment(1)
Yes, but that works only if otherpkg is installed, otherwise the link is broken. If otherpkg is in Suggests: but not Depends:, I cannot rely on that link. I clarified the question.Hoopoe
H
3

In the end, I made otherpkg a dependency.

Hoopoe answered 5/12, 2012 at 8:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.