I would like to know how to create a class in R so that the only parameter that its constructor would accept can be actually used to populate two fields of that class. Example:
myClass <- setClass("myClass", slots = list (a = "numeric", b = "numeric"))
# When I do:
myClass(a = 1)
# I would like here to populate b with a + 1 (or any more complicated logic)
This is the description of the exact issue I'm dealing with. Basically I have a class that represents acyclic directed graphs. Such a graph can be represented at least in two ways: a list of parent/child relationships among nodes or an adjacency matrix. So I want to build each instance by passing that list in and when I do so, I want the corresponding adjacency matrix to be built for me in another field of that class, so I can retrieve any of those as I need them.