-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
In cases where a particular S4 method has extra parameters compared with what is declared in the generic, it looks like roxygen3 doesn't pick up those extra parameters in the usage tags.
For example, if I have a package with a single file defining the 'foo' suite of functions:
#' foo
#'
#' A function
#'
#' @param x x object
#' @param ... any other args
#'
#' @genericMethods
#'
#' @rdname foo-methods
#' @export
setGeneric('foo', function(x, ...) standardGeneric('foo'))
#' @rdname foo-methods
#' @aliases foo,ANY-method
setMethod('foo', signature(x = 'ANY'),
function(x, ...)
return(x))
#' @param y an extra parameter
#' @rdname foo-methods
#' @aliases foo,integer-method
setMethod('foo', signature(x = 'integer'),
function(x, y, ...)
return(x * y))
R CMD check complains about codoc mismatches:
* checking for code/documentation mismatches ... WARNING
Codoc mismatches from documentation object 'foo':
\S4method{foo}{integer}
Code: function(x, y, ...)
Docs: function(x, ...)
Argument names in code not in docs:
y
Mismatches in argument names:
Position: 2 Code: y Docs: ...
* checking Rd \usage sections ... WARNING
Duplicated \argument entries in documentation object 'foo':
‘x’ ‘...’ ‘x’ ‘...’
Documented arguments not in \usage in documentation object 'foo':
‘y’
Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See the chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.
And the resulting documentation does not contain any mention of the parameter y in the Usage section. Also, the arguments x, and ... are repeated a number of times.
foo package:foo R Documentation
foo
Description:
A function
Usage:
foo(x, ...)
## S4 method for signature 'ANY'
foo(x, ...)
## S4 method for signature 'integer'
foo(x, ...)
Arguments:
x: x object
...: any other args
x: x object
...: any other args
y: an extra parameter
x: x object
...: any other args
Method signatures for generic foo:
• ANY
• integer
Am I doing something wrong, or is this a bug?
Metadata
Metadata
Assignees
Labels
No labels