From murdoch.duncan at gmail.com  Mon Oct 21 00:43:13 2013
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Sun, 20 Oct 2013 18:43:13 -0400
Subject: [Rd] Question about selective importing of package functions...
In-Reply-To: <CABG0rfsL-HnzfmKWMd9uBGtXv2UaMeE3zPbohLXQyovap-kqMw@mail.gmail.com>
References: <CABG0rfuqopYT3mDwZ9JXsketm5bw_wcAgzHGy4MrZ1F2HmUfUA@mail.gmail.com>	<526441E8.4000408@gmail.com>
	<CABG0rfsL-HnzfmKWMd9uBGtXv2UaMeE3zPbohLXQyovap-kqMw@mail.gmail.com>
Message-ID: <52645C81.1020309@gmail.com>

On 13-10-20 4:54 PM, Jonathan Greenberg wrote:
> Duncan:
>
> Thanks -- learning something new today -- quick follow-up, will using
> the import statements in the NAMESPACE, when a user goes to
> install.packages(), auto-install the "dependent" packages the same way
> Depends forces?
>

You need to list the other packages in Imports instead of Depends; then 
the answer is yes.

Duncan Murdoch

> --j
>
>
> On Sun, Oct 20, 2013 at 3:49 PM, Duncan Murdoch
> <murdoch.duncan at gmail.com <mailto:murdoch.duncan at gmail.com>> wrote:
>
>     On 13-10-20 4:43 PM, Jonathan Greenberg wrote:
>
>         I'm working on an update for my CRAN package "spatial.tools" and
>         I noticed
>         a new warning when running R CMD CHECK --as-cran:
>
>         * checking CRAN incoming feasibility ... NOTE
>         Maintainer: 'Jonathan Asher Greenberg
>         <spatial-tools at estarcion.net <mailto:spatial-tools at estarcion.net>>'
>         Depends: includes the non-default packages:
>             'sp' 'raster' 'rgdal' 'mmap' 'abind' 'parallel' 'foreach'
>             'doParallel' 'rgeos'
>         Adding so many packages to the search path is excessive
>         and importing selectively is preferable.
>
>         Is this a warning that would need to be fixed pre-CRAN (not
>         really sure
>         how, since I need functions from all of those packages)?  Is
>         there a way to
>         import only a single function from a package, if that function is a
>         dependency?
>
>
>     You really want to use imports.  Those are defined in the NAMESPACE
>     file; you can import everything from a package if you want, but the
>     best style is in fact to just import exactly what you need.  This is
>     more robust than using Depends, and it doesn't add so much to the
>     user's search path, so it's less likely to break something else
>     (e.g. by putting a package on the path that masks some function the
>     user already had there.)
>
>     Duncan Murdoch
>
>
>
>
> --
> Jonathan A. Greenberg, PhD
> Assistant Professor
> Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
> Department of Geography and Geographic Information Science
> University of Illinois at Urbana-Champaign
> 259 Computing Applications Building, MC-150
> 605 East Springfield Avenue
> Champaign, IL  61820-6371
> Phone: 217-300-1924
> http://www.geog.illinois.edu/~jgrn/ <http://www.geog.illinois.edu/%7Ejgrn/>
> AIM: jgrn307, MSN: jgrn307 at hotmail.com <mailto:jgrn307 at hotmail.com>,
> Gchat: jgrn307, Skype: jgrn3007



[Rd] Question about selective importing of package functions...
Duncan Murdoch