Paul Gilbert
2012-Sep-18 21:40 UTC
[Rd] problem with vignettes when S4 classes in packages overlap
( A similar problem is also reported by Sebastian P. Luque with library(maptools) library(trip) in the vignette as below ). 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
Duncan Murdoch
2012-Sep-18 23:23 UTC
[Rd] problem with vignettes when S4 classes in packages overlap
On 12-09-18 5:40 PM, Paul Gilbert wrote:> > ( A similar problem is also reported by Sebastian P. Luque with > library(maptools) > library(trip) > in the vignette as below ). > > 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 UbuntYou'll get the warning in a regular session if you set options(warn=1). I think Sweave is probably doing this so that warnings show up around the time of the chunk they correspond to. It does it in the command line version, but not in the Sweave() function (which would save them up to the end). I don't know if the warning is something you should worry about or not. Duncan Murdoch
Roger Bivand
2012-Sep-19 08:06 UTC
[Rd] problem with vignettes when S4 classes in packages overlap
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