Skip to content
Prev 11276 / 12125 Next

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

? Wed, 5 Feb 2025 19:52:57 -0800
Zhian Kamvar <zkamvar at gmail.com> ?????:
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