[Rd] S4 pb in R 2.5.0

Herve Pages hpages at fhcrc.org
Thu Oct 26 23:18:07 CEST 2006


Hi,

When playing interactively with the S4 system, I've tried
to define the following class:

    > setClass("A", representation("integer"))
    [1] "A"
    > showClass("A")
     
    Slots:
                  
    Name:    .Data
    Class: integer
     
    Extends:
    Class "integer", from data part
    Class "vector", by class "integer", distance 2
    Class "numeric", by class "integer", distance 2

then I realized that I made a typo (I don't want to extend
the "integer" type) so I redefined class A:

    > setClass("A", representation(toto="integer"))
    > showClass("A")
    Slots:
                  
    Name:     toto
    Class: integer

Now if I try to extend A:

    > setClass("Aa", representation("A"))
    Error in reconcilePropertiesAndPrototype(name, slots, prototype,
    superClasses,  :
            "A" is not eligible to be the data part of another class
    (must be a basic class or a virtual class with no slots)

Surprising. And even more surprising: I don't get this if I don't
try to define class A twice or if I invert the order of the 2 calls
to setClass("A", ...)!

    > sessionInfo()
    R version 2.4.0 (2006-10-03)
    x86_64-unknown-linux-gnu
     
    locale:
    LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=en_US;LC_COLLATE=en_US;LC_MONETARY=en_US;LC_MESSAGES=en_US;LC_PAPER=en_US;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US;LC_IDENTIFICATION=C
     
    attached base packages:
    [1] "methods"   "stats"     "graphics"  "grDevices" "utils"    
    "datasets"
    [7] "base"

No problem with R-2.4.0.

Thanks,
H.




More information about the R-devel mailing list