Example code:
our_dist <- dist(USArrests[1:4,])
dend <- as.dendrogram(hclust(our_dist , "ave"))
plot(dend )
I would now wish to have a "dend2dist" function which will turn dend back to our_dist.
Of course, it is not possible to do in full (AFAIK), since the process of turning the dist into the dendrogram aggregated a lot of the data which can not be retrieved. But still, I would like for our "best guess" (assuming which aggregation method was used for the dendrogram), as to what is some distance which would be able to reproduce the original dendrogram.
And of course, tips on how to best implement such a function in R would also be nice.
Any suggestions will be most welcomed, thanks.