[R-pkg-devel] S3 generic/method consistency false positive when dplyr imported

Aaron A. King k|ng@@ @end|ng |rom um|ch@edu
Wed Jan 4 21:54:52 CET 2023


Hi all,

I'm modifying a package so as to remove its dependence on the superseded
packages *reshape2* and *plyr*, in favor of dependence on *dplyr*.  In
particular, I'm just importing the one function `dplyr::bind_rows`.

A curious thing happens, however, as soon as I include this among the
imports.  I begin to get R CMD check NOTEs alerting me to the presence of
S3 generic inconsistencies.  These are associated with two functions in the
package: `filter.mean` and `filter.traj`, which the checker mistakes for S3
methods based on the generic `stats::filter` function.  Actually, these are
not S3 methods.  In fact, they are S4 generics and declared as such.

When *dplyr* is not imported, R CMD check is happy with these functions.
When it is imported, R CMD check complains.

Now I understand that it may be preferable to move away from functions with
names containing dots for this reason, and in fact I am already doing so,
but I think the question is a good one:

Why does inclusion of *dplyr* in the import list appear to trigger these
warnings when they were not there before?

Thanks in advance for any insight you can give!

Aaron A. King, Ph.D.
Nelson G. Hairston Professor of Ecology, Evolutionary Biology, and Complex
Systems
University of Michigan
kinglab.eeb.lsa.umich.edu
GPG Public Key: 0x15780975

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list