Skip to content
Prev 631 / 12125 Next

[R-pkg-devel] Calls to exported dplyr functions from DBI/dplyr backend

On 08/01/2016 8:20 PM, Imanuel Costigan wrote:
If it makes no sense to use your package without dplyr on the search 
path, you should have

Depends:  dplyr

in your DESCRIPTION file rather than Imports:  dplyr.  You should 
explain this choice when you submit to CRAN, because using this means 
that calling library(RSQLServer) will add dplyr to the search path if 
it's not there.  That could mess up something else that a user is doing, 
so should normally be avoided.  It can also cause your functions to 
fail, if a user has already got dplyr on the search path, as well as 
another package that masks some of its functions.  Your package will use 
the first copies it sees (unless you use :: even in this case).

If your package has functions that users might want to use on their own, 
then you should import the dplyr functions that you need, or call them 
with ::.

It doesn't sound like this applies to you, but another possibility is 
that most of your package doesn't need dplyr.  Then you might use

Suggests:  dplyr

and check for it (using "if (requireNamespace('dplyr'))" ) before each 
use with ::.

Duncan Murdoch