Skip to content
Prev 105411 / 398506 Next

Confusing difference in S4 summary method dispatch within an S3 summary

I'm trying to track down a problem I'm having in the Zelig package and
have stumbled across a very odd difference in the method dispatch for
a derived S4 class.

Specifically, I have an object of class ZeligS4vglm, which is a
subclass of vglm and vlm respectively (these are from the VGAM
package).

summary() at the command line prompt of this object calls
summary.vglm, which is what I expect to happen.

However, when summary() is called on this object from within another
summary() (summary.MI in Zelig... MI is an S3 class wrapping a number
of ZeligS4vglm objects in this case), it appears to be using the
generic summary() method and ignoring the summary methods defined for
the object:

Browse[1]> summary(object[[1]])
     Length Class       Mode
[1,] 1      ZeligS4vglm S4

I assume this has something to do with protecting the programmer from
infinite recursion into summary() - i.e. so summary.object <-
function(x) { summary(x) } doesn't blow up the stack - but is there a
workaround?


Chris