[Rd] S4 summary method not being called (VGAM)
Mark.Bravington at csiro.au
Mark.Bravington at csiro.au
Tue Jan 10 02:05:44 CET 2012
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
###############################
More information about the R-devel
mailing list