From gmbecker at ucdavis.edu  Wed Apr 29 19:45:31 2015
From: gmbecker at ucdavis.edu (Gabriel Becker)
Date: Wed, 29 Apr 2015 10:45:31 -0700
Subject: [Rd] R CMD check and missing imports from base packages
In-Reply-To: <CABtg=Kne=YoFcCJz8ZWd2AviveSQxW+T7NU4rexLMKokpC3ugA@mail.gmail.com>
References: <CABtg=K=iq7XVY8NksW-gQq_zr7wk4329Sh67c55JxrFF2HDosQ@mail.gmail.com>
	<CAFOpNVEipQH5RMo3nJ3yrUmtkAd-58ZhikSUwcHNijxv=SjKqQ@mail.gmail.com>
	<CABtg=Kne=YoFcCJz8ZWd2AviveSQxW+T7NU4rexLMKokpC3ugA@mail.gmail.com>
Message-ID: <CADwqtCNsZgtnbf4hXw5jVLRkr+bOgr7kU68JVRTw9NZc+MyvOQ@mail.gmail.com>

Gabor,

To play devil's advocate a bit,  why not just have the package formally
import the functions it wants to use (or the whole package if that is
easier)? Also, if your package Depends on another package, instead of
importing it (e.g. because the end user will need functions in it in order
to meaningfully use your functions), I imagine you *want* to hit symbols in
that package before base, right? Otherwise the Depends mechanism becomes
somewhat crippled because you'd need to import symbols from packages you
Depend on, at least in certain cases.

You don't want to require people to import things like the assignment
operator, or "if", or a bunch of other things in the base package (and
probably not the stuff in grDevices either, though from your description
they would in principle need to do that now).

But why should stats not require an import if you want to guarantee that
you get the density function from stats and not from somewhere else? Isn't
that what ImportFrom is for? Is the reason that it is loaded automatically?

Best,
~G

On Wed, Apr 29, 2015 at 10:00 AM, G?bor Cs?rdi <csardi.gabor at gmail.com>
wrote:

> On Wed, Apr 29, 2015 at 12:53 PM, Winston Chang <winstonchang1 at gmail.com>
> wrote:
>
> > On Tue, Apr 28, 2015 at 3:04 PM, G?bor Cs?rdi <csardi.gabor at gmail.com>
> > wrote:
> > >
> > >
> > > E.g. if package 'ggplot2' uses 'stats::density()', and package 'igraph'
> > > also defines 'density()', and 'igraph' is on the search path, then
> > > 'ggplot2' will call 'igraph::density()' instead of 'stats::density()'.
> >
> >
> > Just to be clear: you mean that this happens when ggplot2 contains a
> > call like 'density()', not 'stats::density()' (but the intention is to
> > call stats::density()), right?
> >
>
> Yes, exactly as you say, I am sorry for the confusion. This is actually a
> real example:
> https://github.com/hadley/ggplot2/issues/1041
>
> Gabor
>
>
> >
> > -Winston
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
Gabriel Becker, PhD
Computational Biologist
Bioinformatics and Computational Biology
Genentech, Inc.

	[[alternative HTML version deleted]]



[Rd] R CMD check and missing imports from base packages
Gabriel Becker