From t.jombart at imperial.ac.uk  Wed Jun  5 18:48:28 2013
From: t.jombart at imperial.ac.uk (Jombart, Thibaut)
Date: Wed, 5 Jun 2013 16:48:28 +0000
Subject: [Rd] conflicting imports despite using importFrom in NAMESPACE
Message-ID: <2CB2DA8E426F3541AB1907F98ABA65706386D41F@icexch-m1.ic.ac.uk>


Dear all, 

It is my understanding that using 'importFrom' in the NAMESPACE of a package allows to avoid conflicts between different packages defining objects with identical names. However, I can still see conflicts while loading the package using 'library'.

Here is a toy example, with a package 'foo' importing 'as.igraph' from the igraph package, and 'nj' from ape.

'foo' uses the following DESCRIPTION file:
----------------------
Package: foo
Version: 0.0-0
Date: 2013/06/04
Title: foo
Author:  John Doe
Maintainer: John Doe <jdoe at nowhere.org>
Imports: igraph, ape
Description: just a test.
License: GPL (>=2)
LazyLoad: yes
----------------------

And the following NAMESPACE:
----------------------
## Export all names
exportPattern(".")

## Export all classes
exportClassPattern(".")

## Import all packages listed as Imports or Depends
importFrom(igraph, as.igraph)
importFrom(ape, nj)
----------------------

The check (R 3.0.1) passes without warnings, but then when loading the package:
> library(foo)
Warning messages:
1: replacing previous import ?as.igraph? when loading ?ape? 
2: replacing previous import ?edges? when loading ?ape? 
> 

I would have assumed only ape::nj and igraph::as.igraph would be imported when loading 'foo', so this conflict should not occur.

There is probably something simple I have missed as I have just began to pay attention to NAMESPACES recently. Reading this post:
http://stackoverflow.com/questions/8637993/better-explanation-of-when-to-use-imports-depends
clarified things a bit, but I still don't understand the warning above.

Any clarification will be much appreciated.

All the best

Thibaut

-- 
######################################
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - School of Public Health
St Mary?s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
t.jombart at imperial.ac.uk
http://sites.google.com/site/thibautjombart/
http://adegenet.r-forge.r-project.org/


[Rd] conflicting imports despite using importFrom in NAMESPACE
Jombart, Thibaut