From plummerm at iarc.fr  Fri Jun 20 22:47:11 2014
From: plummerm at iarc.fr (Martyn Plummer)
Date: Fri, 20 Jun 2014 20:47:11 +0000
Subject: [Rd] R CMD check warning with S3 method
In-Reply-To: <CABdHhvF0-ddRHXB_o3cYqfHkRSUwW122gdWN4htvWfKFPBh9fA@mail.gmail.com>
References: <CAFOpNVGGT+tpdAZ42Q+jkWntAE+N=Ctq_D5pKbVVHx7F6_m0RQ@mail.gmail.com>
	<1403198095.17749.166.camel@braque.iarc.fr>,
	<CABdHhvF0-ddRHXB_o3cYqfHkRSUwW122gdWN4htvWfKFPBh9fA@mail.gmail.com>
Message-ID: <31E214B6DF75104E942856C2F74953CB0519CE55@exchange>

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.

Martyn
________________________________________
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
dplyr.

Hadley

--
http://had.co.nz/
-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}



[Rd] R CMD check warning with S3 method
Martyn Plummer