包的帮助索引页面是否可定制?

Is a package's help index page customizable?

help() 函数允许我们查看包含包内所有函数列表的索引:

help(package=stats)

如果包非常大,帮助页面将自动按字母顺序细分,并通过首字母链接到每个部分(如 stats 的情况)。较小的软件包将按字母顺序包含所有功能。

这个索引页可以自定义吗?

我正在使用 roxygen2,希望能够按 @family 对函数进行分组。

参见 R Packages 的第 10.6 节:

You can use roxygen to provide a help page for your package as a whole.

you need to document NULL, and then manually label it with @docType package and @name . This is also an excellent place to use the @section tag to divide up page into useful categories.

只需创建一个 mypackage.R 文件并将上述 Roxygen 标签应用于 NULL:

#' Mypackage: A package I created
#'
#' MyPackage has different families of functions described below
#' 
#' @section Some functions:
#' * [mysum()] 
#' * [myprod()]
#' 
#' @section Other functions:
#' * [other()]
#' * [foo()]
#'
#' @docType package
#' @name mypackage
NULL

方括号 [] 允许创建指向包功能的链接。