[Rd] Pb with .findInheritedMethods

Herve Pages hpages at fhcrc.org
Fri Oct 27 03:02:44 CEST 2006


Hi again,

This happens with R-2.4.0 and R-devel.

Cheers,
H.

Herve Pages wrote:
> Hi again,
>
>
> Here is a very simplified version of a class hierarchy
> defined in the Biobase package (Bioconductor). I post
> here because this seems to be an S4 related problem:
>
>     setClass("A", representation(name="character"))
>     setMethod("initialize", "A", function(.Object) {.Object at name <- "I'm
>     an A"; .Object})
>
>     setClass("Ab", contains="A")
>     setMethod("initialize", "Ab", function(.Object) callNextMethod(.Object))
>
>     setClass("Abc", contains="Ab")
>
>     setClass("Abcd", contains = c("Abc"))
>
> Now if I do:
>
>     tmp1 <- new("Abc")
>     tmp2 <- new("Abcd")
>
> I get the following warning:
>
>     Warning message:
>     Ambiguous method selection for "initialize", target "Abcd" (the
>     first of the signatures shown will be used)
>         Abc
>         Ab
>      in: .findInheritedMethods(classes, fdef, mtable)
>
> I don't really understand why .findInheritedMethods is
> complaining here...
> And if I don't do 'tmp1 <- new("Abc")' before I
> do 'tmp2 <- new("Abcd")', then I don't get the warning
> anymore!
>
> Does anybody have an explanation for this?
>
>
> Thanks,
> H.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>




More information about the R-devel mailing list