[Rd] R CMD check warning with S3 method

Martyn Plummer plummerm at iarc.fr
Fri Jun 20 22:47:11 CEST 2014

Right. I believe that last time this topic came up (August last year) you said that your preferred solution was to export the method but not the generic. I think that's a good idea.

The reason that it doesn't work with filter is that when you created the generic function filter in the dplyr package you overloaded the non-generic filter function in the stats package. Since stats is a default package that is always on the search path, this means you created an ambiguity that must always be resolved by making the generic function visible.

In particular, the QC code is finding the non-generic filter function when it tries to check that the filter.test (or filter.ggvis) method is working correctly, and that is why you get the warnings.

From: Hadley Wickham [h.wickham at gmail.com]
Sent: 20 June 2014 11:33
To: Martyn Plummer
Cc: winstonchang1 at gmail.com; r-devel at r-project.org
Subject: Re: [Rd] R CMD check warning with S3 method

> When you provide a method for a generic function imported from another
> package then the generic must be on the search path. Otherwise if a user
> types "filter" the dispatch to "filter.test" will never occur.

Right, and this is as desired. If dplyr is not explicitly loaded by
the user, filter.ggvis will never be called.

I don't understand why ggvis should be need to re-export filter from
dplyr - the intent is that filter will be useable with ggvis object,
but you'll only have the filter generic available if you've loaded


This message and its attachments are strictly confidenti...{{dropped:8}}

More information about the R-devel mailing list