[R-pkg-devel] R CHECK warning about new S3 generic/method consistency

Diego Hernangómez Herrero d|ego@hern@ngomezherrero @end|ng |rom gm@||@com
Mon Mar 11 18:43:45 CET 2024


Shouldn’t you include the y argument also in
myscale.default ? Your generic is defining that argument as well.



Have a nice day!


El El lun, 11 mar 2024 a las 18:25, CRAN.r <cran.r using proton.me> escribió:

> 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
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list