Question: I have two dendrograms which I wish to compare to each other in order to find out how "similar" they are. But I don't know of any method to do so (let alone a code to implement it, say, in R).

Any leads ?

**UPDATE** (2014-09-13):

Since asking this question, I have written an R package called [dendextend](http://cran.r-project.org/web/packages/dendextend/), for the visualization, manipulation and **comparison** of dendrogram. This package is on [CRAN](http://cran.r-project.org/web/packages/dendextend/) and comes with a [detailed vignette](http://cran.r-project.org/web/packages/dendextend/vignettes/introduction.html). It includes functions such as `cor_cophenetic`, `cor_bakers_gamma` and `Bk` / `Bk_plot`. As well as a `tanglegram` function for visually comparing two trees.

Answer: 
Comparing dendrograms is not quite the same as comparing hierarchical clusterings, because the former includes the lengths of branches as well as the splits, but I also think that's a good start. I would suggest you read E. B. Fowlkes & C. L. Mallows (1983). "A Method for Comparing Two Hierarchical Clusterings". Journal of the American Statistical Association 78 (383): 553–584 [(link)](http://dx.doi.org/10.2307/2288117). 

Their approach is based on cutting the trees at each level *k*, getting a measure *Bk* that compares the groupings into *k* clusters, and then examining the *Bk* vs *k* plots. The measure *Bk* is based upon looking at pairs of objects and seeing whether they fall into the same cluster or not. 

I am sure that one can write code based on this method, but first we would need to know how the dendrograms are represented in R.
Take a look at [this](http://bioinfo.unice.fr/biodiv/Tree_editors.html) page that has lots of information about software that deals with trees, including dendrograms. I noticed several tools that deal with tree comparison, although I haven't personally used any of them yet. There are a number of references cited there also.