r - 如何为 R6 类记录 S3 泛型?
问题描述
我有一个 R6 类myclass
,我已经as.matrix
为它定义了 S3 泛型。一切正常,但是当我运行 R CMD 检查时,我得到了 2 个注释:
注1:
S3 methods shown with full name in documentation object 'as.matrix.myclass':
'as.matrix.myclass'
The \usage entries for S3 methods should use the \method markup and not
their full name.
See chapter 'Writing R documentation files' in the 'Writing R
Extensions' manual.
笔记2:
Found the following apparent S3 methods exported but not registered:
as.matrix.myclass
See section 'Registering S3 methods' in the 'Writing R Extensions'
manual.
以下是我如何定义和记录我的 S3 泛型(这在 R6 类之外):
#' Converts all cores to R matrices
#'
#' @param x \code{myclass}
#' @param ... other arguments passed to \code{as.matrix()}
#' @return A named list of R matrices.
#' @export
as.matrix.myclass <- function(x, ...) {
sapply(
x$cores,
function(x, ...) as.matrix(x, ...),
USE.NAMES = TRUE, simplify = FALSE
)
}
我正在使用支持 R6 文档的较新版本的 roxygen,但我找不到有关如何摆脱这些注释的任何信息。谢谢!
解决方案
正如@Mikko 建议的那样,我更新了我的 roxygen 版本(我原来的帖子现在已经相当老了)。在 7.1.1 中,我不再收到该注释。谢谢!
推荐阅读
- javascript - 如何使这个功能更小?
- c# - 在编辑器会话之间存储编辑器值
- java - 使用带有分页的 java 在 GCS 中列出 Blob 不断获得相同的 Blob 页
- python - 如何将列表列表打印成合理的表格格式
- r - 是否有一种简短的方法可以检查 R 中每个变量的不等价性?
- java - 错误:“错误:资源'attr / layout_anchorGravity'的重复值与配置''.in android studio?
- python - 是否有一些代码的行为方式与 oracle 中的“add_month”相同?
- shell - 提取第三列中字符匹配的行
- elasticsearch - 将 Wkt(多面体)添加到 ElasticSearch 时解析异常
- sql - Identity_insert 设置为 OFF 错误,即使它设置为 ON