From Roger.Bivand at nhh.no  Wed Sep 19 10:06:10 2012
From: Roger.Bivand at nhh.no (Roger Bivand)
Date: Wed, 19 Sep 2012 10:06:10 +0200 (CEST)
Subject: [Rd] problem with vignettes when S4 classes in packages overlap
In-Reply-To: <5058EA54.8050305@gmail.com>
References: <5058EA54.8050305@gmail.com>
Message-ID: <alpine.LRH.2.02.1209190946151.1094@reclus.nhh.no>

On Tue, 18 Sep 2012, Paul Gilbert wrote:

>
> ( A similar problem is also reported by Sebastian P. Luque with
>  library(maptools)
>  library(trip)
> in the vignette as below ).

Thanks for bringing this up. This is caused by maptools avoiding: Depends: 
spatstat, which might create circularities. maptools and spatstat (which 
defines the classes that maptools and trip augment by adding coercion to 
and from their own or sp classes) mutually Suggest: each other. trip 
Depends: spatstat, but out of the box has no NAMESPACE - I haven't 
investigated whether adding one helps.

Adding maptools to trip::Depends removes the warnings; check passes as 
before, so no side-effects I can see. The auto-generated NAMESPACE is 
then:

# Default NAMESPACE created by R
# Remove the previous line if you edit this file

# Export all names
exportPattern(".")

# Import all packages listed as Imports or Depends
import(
   methods,
   sp,
   spatstat,
   maptools
)

Since trip was last updated in May 2011, it is missing both a NAMESPACE 
file, and suggestion of the correct adehabitat?? package(s) - adehabitat 
is deprecated. I don't think that this is an S4 problem, I think it is 
about keeping packages in sync with the R engine, especially with regard 
to NAMESPACE, etc., and with packages named in DESCRIPTION. This may carry 
over to the main case here, but I haven't checked.

Roger

>
> I am writing a vignette which loads RMySQL and RPostgreSQL. This produces the 
> warning:
>
> Loading required package: DBI
> Warning in .simpleDuplicateClass(def, prev) :
>  A specification for class ?dbObjectId? in package ?RPostgreSQL? seems 
> equivalent to one from package ?RMySQL? and is not turning on duplicate class 
> definitions for this class
>
> This can be reproduced by running
>  R CMD Sweave --pdf Atest.Stex
>
> where the file Atest.Stex has the lines
>
> \documentclass{article}
> \usepackage{Sweave}
> \begin{document}
> \begin{Scode}
> library("RMySQL")
> library("RPostgreSQL")
> \end{Scode}
> \end{document}
>
> These warnings only happen in a vignette. They are not produced if the lines 
> are entered in an R session.
>
> (Using R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows" on Ubuntu)
>
> Paul
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


[Rd] problem with vignettes when S4 classes in packages overlap
Roger Bivand