On 11/03/2024 2:13 p.m., CRAN.r wrote:
On Monday, March 11th, 2024 at 12:43 PM, Diego Hernangómez Herrero 
<diego.hernangomezherr...@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.

No, your assumption is backwards. The methods do need to include all arguments of the generic. As Writing R Extensions says near the start of section 7, "A method must have all the arguments of the generic, including … if the generic does."

Think about your user. They'll ask about help for `inmyscale`, and see that it has two arguments, x and y. If x is a type that goes to `inmyscale.default`, the user would receive an error when they followed the docs and included the y value.

The usual way to handle this is to include both x and y in all methods, but document some of them to say that y is ignored.

Duncan Murdoch

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to