I’m teaching myself R, well, more like playing around in it; the Binary Tree package to be specific. After I got the example on that page working, I thought I’d try to walk UP the tree from the terminal nodes to the parent. This particular package doesn’t seem to have a getParent() function/method (that I can discern) that will do what I want.
So I thought I should convert the tree to some other object: a graph, an array of text strings, whatever, but I don’t seem to have good enough google-fu to find what I’m looking for. I’m still trying to find my way around the documentation as well.
So how would how would someone who knows what (s)he’s doing walk up the tree in the example given on the web page?
Well, here’s a function that traverses the tree and adds the parent to each node.
BTW, I think I’d rather climb up a tree than walk up it 😉