Displaying 2 results from an estimated 2 matches for "mr_x".
Did you mean:
mr_k
2020 Oct 05
2
S4 - inheritance changed by order of setClassUnion and setAs()
...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 "mother" and "grandma".
setClass("grandma", slots = c(a = "character"))
setClass("mother", slots = c(b = "matrix"), contains = "grandma")
setClass(&...
2020 Oct 06
0
S4 - inheritance changed by order of setClassUnion and setAs()
...lass("grandma", slots = c(a = "character"))
> setClass("mother", slots = c(b = "matrix"), contains = "grandma")
> setClass("daughter", slots = c(c = "list"), contains = "mother")
> setClassUnion(name = "mr_x", members = c("daughter", "mother"))
> setClassUnion(name = "mr_y", members = c("daughter", "mother"))
> getClass("daughter")
Class "daughter" [in ".GlobalEnv"]
Slots:
Name: c b...