3

I want to make colored dendrograms and have yet to find a sufficient library: http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=79 This graphic/library looks promising but cannot install the A2E library? Trying to install on windows, downloaded the tar.gz file and cannot install package from the R console.

In addition:

Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In gzfile(file, "r") :
  cannot open compressed file 'A2R_0.0-4.tar.gz/DESCRIPTION', probable reason 'No such file or directory'

Can anyone see if they can get this A2R library working, confirm error, or suggest a good colored dendrogram library?

chl
  • 27,771
  • 5
  • 51
  • 71
user291071
  • 351
  • 1
  • 6
  • 12
  • 1
    Here's a post on coloring dendrograms from a while ago: http://stackoverflow.com/questions/4720307/change-dendrogram-leafs-in-r – Roman Luštrik May 15 '11 at 08:22

2 Answers2

4

(It might help if you spelled it correctly.) A2R is a source package. So you might need to have the system toolchain for compilation. Those are typically in your system if you are on Linux, but not if you are on a Mac (as I am) or on Windows. The package does compile from source on a Mac. And the compilation process may not have needed the toolchain. So try this:

install.packages("<fullpath> A2R_0.0-4.tar.gz", type ="source")

There are a few other dependencies: 'trimcluster', 'prabclus' , 'MASS' , 'cluster', 'mclust', 'flexmix', 'modeltools', 'stats4', 'multcomp', 'mvtnorm'. I am able to get most of that graphic but the left side curve does not appear as shown and I did get an error:

     Error in hubertgamma[i] <- cluster.stats(d.usa, cutree(h.usa, k = i +  : 
  replacement has length zero:

This is the example plot

If you do not want the heights of the dendrogram scaled to their depth you can add this modification to the hclust object:

h.usa$height <- log(h.usa$height)
IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • thx yes i needed the type="source" > install.packages("C:/Revolution/R-Enterprise-4.3/A2R_0.0-4.tar.gz", type ="source") inferring 'repos = NULL' from the file name – user291071 May 14 '11 at 19:43
  • you mentioned you've used this before, i have it now working, but am trying to figure out how to alter lengths or depths of branches, as i have a larger dataset and am finding the last layer of the dendrogram branches to have almost 0 height. I figured out how to add more colors etc already. Any tips appreciated – user291071 May 14 '11 at 23:19
  • Sounds like you have a new question. – Roman Luštrik May 15 '11 at 05:22
  • After looking at the code and examining the hclust object I wondered if `log()-ing` the heights would work and it did. Code above and then just rerun the A2Rplot() call. – IRTFM May 15 '11 at 13:49
1

You could use the dendrapply() function in R's built-in dendrogram code to apply custom leaf and node coloring. See the following mailing list thread for hints.

Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345