I have been fighting with this for quite a long time and cannot get it to work, so I am posting here. I'm not an advanced R user, but I'm learning and slowly getting onward. I have not found an example from Stackoverflow that I could adapt to this, the examples seem to have a different structure with no need to loop through each higher level attribute for each node. Or that's how I understand the difference now. The question is similar to I have been fighting with this for quite a long