[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 19:20:22 CET 2024


Usually when I write a generic I use … in the definition to allow using
additional arguments in specific methods, see

as_bibentry <- function(x, ...) { UseMethod("as_bibentry")
 }

as_bibentry.cff <- function(x, ..., what = c("preferred", "references",
"all")) {

<code>
}

but in any case the method must include at least the arguments defined in
the same order. Using … in the generic allows me to include `what` arg with
no WARNINGs.




Have a nice day!


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

> On Monday, March 11th, 2024 at 12:43 PM, Diego Hernangómez Herrero <
> diego.hernangomezherrero using gmail.com> wrote:
>
> > Shouldn’t you include the y argument also inmyscale.default ? Your
> generic is defining that argument as well.
>
> I assume (hopefully correctly) that methods don't need to include all the
> arguments of the generic. I get the same warning if I use "..." instead of
> y, too.
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list