R 包文档:link 到整个包,而不是函数

R package documentation: link to a whole package, not function

我想在我正在开发的一些函数的文档中引用另一个包(整个包,而不仅仅是它的一个函数)。我正在使用 Roxygen2 注释来记录我的包功能。

我找不到使用 Roxygen2 为整个 third-party 包创建 link 的方法。要 link 到包函数,可以写 [pkg::fun()] 但我不知道如何为包本身创建 link。

一些软件包公开了一个通用的手册页,并且可以通过例如 link 访问它。 [pkg::pkg].

但是很多软件包没有这个,只有一个通用的软件包小插图,其中包含函数列表和 link 描述:

可以通过在 RStudio 的包选项卡中单击包名称来访问此类页面。

如何从 Roxygen2 markdown 制作的函数文档中 link 到它?

您无法 link 在单击 RStudio 的“包”窗格中的包名称时出现的页面。 RStudio 不可见地调用 help(package = "<name>"),它呈现包的 index.

来自R-exts manual:

The markup \link{foo} (usually in the combination \code{\link{foo}}) produces a hyperlink to the help for foo. Here foo is a topic, that is the argument of \alias markup in another Rd file (possibly in another package).

因此 \linkroxygen2 支持的等效 Markdown 标记只能 link 主题。包索引不是这个意义上的主题,因为没有相应的 Rd 文件。

最好只是提醒用户,他们可以使用 help 访问您所引用的包的索引。