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

Roger Bivand Roger.Bivand at nhh.no
Wed Sep 19 10:06:10 CEST 2012

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 

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

# Export all names

# Import all packages listed as Imports or Depends

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.


> 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

More information about the R-devel mailing list