I have an R6 class myclass
, and I have defined the S3 generic as.matrix
for it. Everything works, but I'm getting 2 notes when I run R CMD check:
Note 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.
Note 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.
Here is how I have my S3 generic defined and documented (this is outside the R6 class):
#' 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
)
}
I'm using a newer version of roxygen that supports R6 documentation, but I can't find any info on how to get rid of these notes. Thanks!
As @Mikko suggested, I updated my version of roxygen (my original post is fairly old now). In 7.1.1, I no longer get the note. Thanks!