1

I am currently using the dendextend R package to export the data from an R dendrogram. I am specifically looking to extract the coordinates of each of the nodes in a dendrogram and also the start and stop position of each of the branches.

Getting the coordinates of the nodes seem to be fairly simple by using the dentextend::get_nodes_xy() function. However, I am not able to find any function that outputs the start and stop position of each of the branches in the dendrogram. Alternatively, if for each of the derived nodes (non-leaf nodes), if I could get the child nodes, I could calculate the start/stop position of the branches on my own.

In principle, a command like dend %>% unclass %>% str will print out the dendrogram, but this format is too cumbersome to parse especially for dendrograms with a very large number of nodes. So, I was wondering is there any way to get information about the child nodes for every node (not just leaves) in the dendrogram. It seems only the leaves have a label and non-leaf nodes do not have labels.

Looking for a function that prints start/stop position of branches of a dendrogram, or at least outputs the child nodes for every node in the dendrogram.

Michael Roswell
  • 1,300
  • 12
  • 31
Robin Paul
  • 11
  • 1
  • 1
    Welcome to SO! Can you provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) to give folks a better sense of what kind of data you're working with, and see what is cumbersome about the code you posted? – Michael Roswell May 09 '23 at 19:58

0 Answers0