Displaying 2 results from an estimated 2 matches for "people1".
Did you mean:
people
2020 Oct 05
2
S4 - inheritance changed by order of setClassUnion and setAs()
Dear colleagues,
there is a behaviour with S4 (virtual) classes that I find very hard to understand: Depending on the position
of setAs(), the tree of inheritance changes.
This is my baseline example that defines the classes "grandma", "mother", "daughter" and a virtual
class "mr_x". For a new instance if "daughter", "mr_x" is betweeen
2020 Oct 06
0
S4 - inheritance changed by order of setClassUnion and setAs()
...nce via the normal contains
mechanism. In practice, how could it not matter?
Multiple inheritence is very powerful but dangerous.
> setClass("person1", slots = c(f = "character"))
> setClass("person2", slots = c(g = "character"))
> setClass("people1",* contains = c("person1", "person2")*)
> getClass("people1")
Class "people1" [in ".GlobalEnv"]
Slots:
Name: f g
Class: character character
Extends: "person1", "person2"
> setClass("peo...