[R-pkg-devel] S3 generic/method consistency NOTE

Ivan Krylov |kry|ov @end|ng |rom d|@root@org
Thu Feb 6 09:10:19 CET 2025


В Wed, 5 Feb 2025 19:52:57 -0800
Zhian Kamvar <zkamvar using gmail.com> пишет:

>   Mismatches for methods registered for non-generic:
>   is:
>     function(object, class2)
>   is.genind:
>     function(x)
> 
>   is:
>     function(object, class2)
>   is.genpop:
>     function(x)
> 
>   sample:
>     function(x, size, replace, prob)
>   sample.haploGen:
>     function(x, n)

Neither methods::is nor base::sample are S3 generics, so these S3
method registrations are not needed:

https://github.com/thibautjombart/adegenet/blob/e4874e73f0d39ebdddeca05b7eb1359fab771aaf/NAMESPACE#L50-L51
https://github.com/thibautjombart/adegenet/blob/e4874e73f0d39ebdddeca05b7eb1359fab771aaf/NAMESPACE#L73

In other words, calling is(new("genind", ...)) or sample(haploGen(...))
won't dispatch to is.genind() or sample.haploGen() anyway; these
functions are probably intended to be called by their full names.

Removing these lines and re-generating NAMESPACE should help:

https://github.com/thibautjombart/adegenet/blob/e4874e73f0d39ebdddeca05b7eb1359fab771aaf/R/basicMethods.R#L546
https://github.com/thibautjombart/adegenet/blob/e4874e73f0d39ebdddeca05b7eb1359fab771aaf/R/basicMethods.R#L553
https://github.com/thibautjombart/adegenet/blob/e4874e73f0d39ebdddeca05b7eb1359fab771aaf/R/haploGen.R#L529

-- 
Best regards,
Ivan



More information about the R-package-devel mailing list