Skip to content

directives to explicitely exclude objects from import into namespaces

5 messages · Peter Ruckdeschel, Duncan Murdoch, Kasper Daniel Hansen +2 more

#
Hi,

recently R CMD check --as-cran has noticed some more issues with
package namespace imports with the recommended remedy to
use importFrom() and friends.

In my case, there was only a conflict restricted to some few imports,
while I would prefer to still import all the non-conflicting objects,
methods, and classes of the respective package namespace.

So would it be possible to have some new directives along the lines

import(<pkg>) ## importing the whole namespace of <pkg> in a first step
notimportFrom(<pkg>, <obj1>, <obj2>,....)
           ##  exclude <obj1>, <obj2>, ... again from the previous namespace import
           ## and, similarly,
notimportMethodsFrom(<pkg>, <meth1>, <meth2>,....)
notimportClassesFrom(<pkg>, <cls1>, <cls2>,....)

in the NAMESPACE file?

Otherwise the list of object, methods, classes to be explicitely imported
(in my case) got very long (and hence hard to maintain) -- much longer
than the list of items to be excluded from an import.

Or have I overseen some obvious, easier way to achieve this?

Best regards, Peter
#
On 13-09-06 4:54 PM, Dr. Peter Ruckdeschel wrote:
This doesn't make sense to me.  How could it be easier to maintain a 
list over which you don't have control instead of one over which you do 
have control?

Duncan Murdoch
#
I also second Peter's proposal. I think that it is particularly helpful to
save time for maintainers of packages that were developed a longer time ago.
When writing new packages, it is relatively easy to keep track of which
functions from which packages need to be imported; when maintaining older
code, working this out can be a lot of work.

Best, Ulrike



--
View this message in context: http://r.789695.n4.nabble.com/directives-to-explicitely-exclude-objects-from-import-into-namespaces-tp4675564p4675594.html
Sent from the R devel mailing list archive at Nabble.com.
#
It's difficult to do by hand, but it's not too hard to automate - take
a look at https://github.com/hadley/roxygen3/blob/master/R/auto-imports.r.
It's part of roxygen3, but the code is relatively straighforward and
doesn't depend on much else in the package.

Hadley
On Sat, Sep 7, 2013 at 7:48 AM, Ulrike Gr?mping <groemping at bht-berlin.de> wrote: