Re: [Rd] S4 summary method not being called (VGAM)

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue, 10 Jan 2012 17:47:35 +0000

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

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 10 Jan 2012 - 17:52:14 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 10 Jan 2012 - 18:20:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive