From ripley at stats.ox.ac.uk  Tue Jan 10 18:47:35 2012
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 10 Jan 2012 17:47:35 +0000
Subject: [Rd] S4 summary method not being called (VGAM)
In-Reply-To: <4F0C6AA4.4080102@r-project.org>
References: <3D59DF35E7CF3E42BA70C23BD5CBE6A85F6DA93028@exvic-mbx04.nexus.csiro.au>
	<4F0C6AA4.4080102@r-project.org>
Message-ID: <4F0C79B7.7050907@stats.ox.ac.uk>

All maintainers of CRAN packages which produced such a report were asked 
for an update a week or so ago.  Several have already done so.

The remaining list is
DMwR FAiR VGAM arm arulesSequences dcmle depmixS4 flip mirt spacom tlemix


On 10/01/2012 16:43, John Chambers wrote:
> A relevant report, not just for VGAM but for maintainers of other
> packages that define methods for functions that have both generic and
> non-generic versions in other packages.
>
> The problem is that VGAM "Depends" on stats4 but does not import from
> it. So when VGAM is loaded, only the old version of summary() is
> available. Importing the relevant functions from stats4 in VGAM should
> fix the problem.
>
> With the current R 2.14.1 this happens silently. With the latest
> r-devel, the installation of VGAM produces a warning:
>
> "Functions for exporting methods must have been made generic, explicitly
> or implicitly; not true when loading 'VGAM' for 'AIC', 'coef', 'logLik',
> 'plot', 'summary', 'vcov' "
>
> This implies (a bit obscurely) that the package has generic versions in
> its dependencies, but has not imported them.
>
> Maintainers of CRAN packages should check installation against the
> development version. Warning messages like this suggest a problem with
> the imports.
>
>
> John
>
> On 1/9/12 5:05 PM, Mark.Bravington at csiro.au wrote:
>> The symptom triggering this email is that an S4 summary method
>> sometimes refuses to be invoked, even when a package is explicitly
>> loaded, if the first load of the package is implicit. It may or may
>> not be specific to 'summary' methods and/or the 'VGAM' package. I've
>> sent to R-devel because (i) it looks like some kind of bug to me, but
>> I'm not sure; (ii) it's not something I personally need any help with;
>> and (iii) it seems a bit specialized for R-help.
>>
>> Here's the case notes. I have an object 'nf1' of S4 class 'vglm',
>> created by calling 'vglm(...)' from package 'VGAM' (you can create
>> your own from the examples in VGAM). It's save()d into a file
>> "nf1.rda". If I start a new R session, call 'library( VGAM)', and then
>> 'load("nf1.rda")', then 'summary(nf1)' works fine. But if instead I
>> start a pretty basic R session and load() the file *without* having
>> explicitly called library( VGAM), the summary method for 'vglm'
>> doesn't get called whether or not I subsequently call library( VGAM).
>> Transcript below.
>>
>> I'm using R 2.13.2 on Windows XP, VGAM 0.8-4. The same thing happens
>> with R 2.15 devel v57866.
>>
>> bye
>> Mark
>>
>> Mark Bravington
>> CSIRO CMIS
>> Marine Lab
>> Hobart
>> Australia
>>
>>
>> #############################
>> # Start a basic R session, and then:
>>
>>> search()
>> [1] ".GlobalEnv" "package:stats4" "package:splines" "package:stats"
>> "package:graphics"
>> [6] "package:grDevices" "package:utils" "package:datasets"
>> "package:methods" "Autoloads" "package:base"
>>
>>> print( load( "nf1.rda")) # which should implicitly load VGAM, but not
>>> attach it
>> [1] "nf1"
>>
>>> search()
>> # ...snipped. No explicit VGAM
>>
>>> loadedNamespaces()
>> # ...snipped. VGAM is there at the end.
>>
>>> nf1
>> Call:
>> vglm(formula = form, family = posbinomial, data = data, trace = TRUE)
>>
>> Coefficients:
>> # ...snipped. The print() or show() or whatever method seems to get
>> called OK
>>
>>> summary( nf1)
>> Length Class Mode
>> 1 vglm S4
>>
>> # Hmmm... default method is being called, that's wrong. Try explicitly
>> attaching 'VGAM':
>>
>>> library( VGAM)
>> Loading required package: splines
>> Loading required package: stats4
>>
>> Attaching package: 'VGAM'
>>
>> The following object(s) are masked from 'package:splines':
>>
>> bs, ns
>>
>> The following object(s) are masked from 'package:stats':
>>
>> biplot, case.names, coefficients, df.residual, fitted, fitted.values,
>> formula, poly, residuals,
>> variable.names, weights
>>
>> The following object(s) are masked from 'package:base':
>>
>> identity, print, scale.default
>>
>>> summary( nf1)
>> Length Class Mode
>> 1 vglm S4
>> # Hmmm... even though VGAM is on the search path etc, the wrong method
>> is being called
>>
>> ###############################
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] S4 summary method not being called (VGAM)
Prof Brian Ripley