Re: [R] inheritence in S4

From: <>
Date: Mon, 24 Mar 2008 10:42:04 +0100

Hi Martin

I am re reading all the mail we exchange with new eyes because of all the thing I learn in the past few weeks. That very interesting and some new question occurs...

Once, you speak about callGeneric :

setClass("A", representation(x="numeric")) setClass("C", contains=c("A"))

setMethod("show", "A", function(object) cat("A\n")) setMethod("show", "C", function(object) {

   callGeneric(as(object, "A"))


Considere the following definition (that you more or less teach me with your yesterday remarques...) :

setMethod("show", "C", function(object) {



In this case, is there any difference between the former and the latter ? Which one would you use ?

(I get that in more complicate case, for example if setClass("C", contains=c("A","B")), it might be more complicate to use the latter, right ?)

This works :


          function(.Object,..., yValue){
              callNextMethod(.Object, ..., y=yValue)


but this does not :


          function(.Object, yValue){
              callNextMethod(.Object, y=yValue)


Why ?
Is there any help page about ... ?

showMethods gives the list of all the method. Is there a way to see all the method for a specific signature IN THE ORDER they will be call by callNextMethod ?
If ANY <- D <- E, a method that will gives :

Function "initialize":
.Object = "E"
.Object = "D"

.Object = "ANY"

Thanks for your help
And happy easter eggs !


Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 24 Mar 2008 - 09:48:06 GMT

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 Mon 24 Mar 2008 - 17:30:23 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive