[R-pkg-devel] R CHECK warning about new S3 generic/method consistency
CRAN.r
cr@n@r @end|ng |rom proton@me
Mon Mar 11 16:22:52 CET 2024
I'm trying to define a new generic, and keep getting an S3 generic/method consistency when running R CHECK. All of the code seems to be working, and I'm not getting any note, errors, or other warnings.
This minimal example shows the warning I'm getting. The functions are
myscale <- function(x, y) UseMethod("myscale")
myscale.default <- function(x) x
The usage section of the man file is
\usage{
myscale(x, y)
\method{myscale}{default}(x)
}
and the NAMESPACE file is
export("myscale", "myscale.default")
S3method(myscale, default)
When I build the package and run CHECK, I get
* checking S3 generic/method consistency ... WARNING
myscale:
function(x, y)
myscale.default:
function(x)
See section 'Generic functions and methods' in the 'Writing R
Extensions' manual.
As I understand it, there shouldn't be a problem as long as the generic function contains all possible arguments of any method, and the methods have their arguments in the same order as the generic. It seems that having one method with only "x" shouldn't be a problem. I've read the section mentioned in the warning, but I can't figure out what's going on. Is any of this wrong?
Jay
More information about the R-package-devel
mailing list