Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Colored dendrogram suggestions?

Tags:

r

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?

like image 649
user291071 Avatar asked Sep 06 '26 11:09

user291071


2 Answers

(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)
like image 122
IRTFM Avatar answered Sep 08 '26 01:09

IRTFM


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.

like image 35
Alex Reynolds Avatar answered Sep 08 '26 01:09

Alex Reynolds



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!