R 文档:@family 标签不起作用
R documentation: the @family tag is not working
我正在编写一个 R 包,我想在函数文档之间包含交叉引用。
在文档 here 之后,有一个章节专门讨论了这个问题:
Cross-references
There are two tags that make it easier for people to navigate around your documentation: @seealso
and @family
. [...] If you have a family of related functions, you can use @family {family}
to cross-reference each function to every other function within the family. A function can be a member of multiple families.
For sum()
, this might look like:
#' @family aggregations
#' @seealso [prod()] for products, [cumsum()] for cumulative sums, and
#' [colSums()]/[rowSums()] marginal sums over high-dimensional arrays.
By default @family {family}
, will generate the see also text “Other {family}:”
, so the @family
name should be plural (i.e., “model building helpers”
not “model building helper”
). You can override the default title by providing a rd_family_title
list in man/roxygen/meta.R
:
rd_family_title <- list(
aggregations = "Aggregation functions"
)
所以,我编写了我的函数的文档,如下所示:
#' My foo function
#'
#' Does something with my data.
#'
#' Lorem ipsum.
#'
#' @param .data A data frame.
#' @return My processed data.
#' @usage
#' my_foo_function(.data)
#' @family {a_family}
#' @family {another_family}
#' @export
my_foo_function <- function(.data) {
# Some code
}
(我这样写了大约9个函数)
我也写了这个meta.R
文件:
rd_family_title <- list(
a_family = "A family of functions",
another_family = "Another family of functions"
)
保存在这里:[package project path]/roxygen/man/meta.R
(同样,遵循文档)。
但是,当我 运行 document()
函数(构建 .Rd
文件)时,我收到以下警告:
document()
## Updating my_package documentation
## Writing NAMESPACE
## Warning messages:
## 1: Unknown Roxygen options a_family, another_family.
## Supported options: roclets, load, old_usage, markdown, r6, package
并且,在浏览文档时,我看到了这样的内容:
[...]
See also
Other a_family: bar(), baz()
Other another_family: spam(), eggs()
(我将 @family {a_family}
更改为 @family a_family
,结果相同。
所以...我错过了什么? rd_family_title
列表应该放在哪里?为什么 Roxygen 无法用我定义的标题替换 "other..." 内容?
一些附加信息:
- R 版本:3.6.0,运行在 CentOs 7 上运行,并使用 Rstudio
- Roxygen2 版本:7.0.2
- 开发工具版本:2.2.1
这已在 PR 1078 which is included in the roxygen2 7.1.1 release 中修复。
我正在编写一个 R 包,我想在函数文档之间包含交叉引用。
在文档 here 之后,有一个章节专门讨论了这个问题:
Cross-references
There are two tags that make it easier for people to navigate around your documentation:
@seealso
and@family
. [...] If you have a family of related functions, you can use@family {family}
to cross-reference each function to every other function within the family. A function can be a member of multiple families.For
sum()
, this might look like:#' @family aggregations #' @seealso [prod()] for products, [cumsum()] for cumulative sums, and #' [colSums()]/[rowSums()] marginal sums over high-dimensional arrays.
By default
@family {family}
, will generate the see also text“Other {family}:”
, so the@family
name should be plural (i.e.,“model building helpers”
not“model building helper”
). You can override the default title by providing ard_family_title
list inman/roxygen/meta.R
:rd_family_title <- list( aggregations = "Aggregation functions" )
所以,我编写了我的函数的文档,如下所示:
#' My foo function
#'
#' Does something with my data.
#'
#' Lorem ipsum.
#'
#' @param .data A data frame.
#' @return My processed data.
#' @usage
#' my_foo_function(.data)
#' @family {a_family}
#' @family {another_family}
#' @export
my_foo_function <- function(.data) {
# Some code
}
(我这样写了大约9个函数)
我也写了这个meta.R
文件:
rd_family_title <- list(
a_family = "A family of functions",
another_family = "Another family of functions"
)
保存在这里:[package project path]/roxygen/man/meta.R
(同样,遵循文档)。
但是,当我 运行 document()
函数(构建 .Rd
文件)时,我收到以下警告:
document()
## Updating my_package documentation
## Writing NAMESPACE
## Warning messages:
## 1: Unknown Roxygen options a_family, another_family.
## Supported options: roclets, load, old_usage, markdown, r6, package
并且,在浏览文档时,我看到了这样的内容:
[...]
See also
Other a_family: bar(), baz() Other another_family: spam(), eggs()
(我将 @family {a_family}
更改为 @family a_family
,结果相同。
所以...我错过了什么? rd_family_title
列表应该放在哪里?为什么 Roxygen 无法用我定义的标题替换 "other..." 内容?
一些附加信息:
- R 版本:3.6.0,运行在 CentOs 7 上运行,并使用 Rstudio
- Roxygen2 版本:7.0.2
- 开发工具版本:2.2.1
这已在 PR 1078 which is included in the roxygen2 7.1.1 release 中修复。