I am having some trouble creating a hierarchy of virtual classes
(akin to the class structure in the 'Matrix' package). I think they
arise from my not understanding the best way to specify virtual
subclasses of a virtual class. please see questions below code.
setClass("mom")
setClass("kid1", representation("mom", "VIRTUAL"))
setClass("kid2", representation("VIRTUAL"), contains = "mom")
setClass("kid3"); setIs("kid3", "mom")
(i) Are 'kid1' and 'kid2' equivalent? I.e., is there any difference
between including a superclass as an unnamed argument in the
'representation' call and including it in the 'contains' argument?
If not, why does the 'contains' argument exist?
(ii) What is the difference between 'kid1' and 'kid2', on the one
hand, and 'kid3', on the other hand? I see that 'kid1' and 'kid2'
have prototypes of class 'S4', while 'kid3' has a prototype of class
"NULL". But I don't really understand the implications of that. I
am using virtual classes mostly to economize on method writing. Will
it matter on any level whether my virtual classes have NULL or S4
prototypes?
On a related note, the behavior exhibited below also seems infelicitous
setClass("kid4", contains = "mom")
new("kid4") # error in the show method
franklin parlamis
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel