[R] heatmap & cluster

Duke duke.lists at gmx.com
Fri Feb 18 17:40:38 CET 2011


Hi all,

I am new to heatmap function in stats package, so any advice will be 
greatly appreciated. So I have a dataset that I want to draw a heatmap, 
for example:

 > dput(a)
structure(c(-8.256023, -14.764429, -10.145779, -5.123104, -11.974729,
-16.329029, -16.329029, -16.329029, -2.764114, -4.924921, -7.321333,
-2.126415, -2.854843, -12.222569, -12.259916, -16.329029, -9.313669,
-16.329029, -5.094692, -12.732754, -11.327074, -16.329029, -15.172729,
-10.447779, -14.086353, -16.329029, -10.383026, -3.319923, -14.463295,
-16.329029, -8.449667, -8.253173, -13.481955, -9.660365, -5.394456,
-11.934001, -16.294595, -16.294595, -14.250207, -2.62437, -4.644073,
-7.067632, -2.445758, -2.948815, -12.52094, -12.514855, -16.294595,
-9.087692, -16.294595, -4.850505, -12.895911, -11.067373, -16.294595,
-14.268018, -10.069949, -13.807715, -13.527525, -10.316585, -3.417455,
-14.623739, -16.294595, -8.502865, -10.403515, -15.2687, -8.355925,
-6.885027, -13.231369, -16.198643, -16.198643, -15.764126, -3.919298,
-4.499501, -9.05365, -3.968495, -4.655705, -13.426923, -14.570927,
-16.198643, -7.830833, -16.198643, -7.067999, -15.453797, -11.583553,
-16.198643, -14.172943, -12.111882, -16.198643, -16.198643, -12.738674,
-4.654217, -16.198643, -16.198643, -7.265043, -9.8028525, -13.7499485,
-8.2308125, -6.5919095, -12.6615125, -16.2597525, -15.1882525,
-15.3079125, -3.8327565, -4.2444845, -8.6616275, -3.4870585,
-4.7037395, -13.5807625, -13.7311925, -16.2597525, -6.9568865,
-16.2597525, -6.8470535, -15.1680125, -11.4887425, -16.2597525,
-16.2597525, -12.7272155, -16.2597525, -14.2869125, -12.5119475,
-4.5236895, -16.2597525, -16.2597525, -7.0275195, -8.9830315,
-13.0446825, -8.1959965, -4.6491995, -11.9283305, -16.9771775,
-16.9771775, -13.7994815, -4.4080155, -1.6757765, -7.9315575,
-3.2130445, -3.4857205, -13.1048685, -13.9564575, -16.9771775,
-6.1871915, -16.9771775, -4.3551415, -12.0167665, -10.7453525,
-16.9771775, -16.0470245, -12.0249945, -15.4854135, -13.3358695,
-10.0600285, -4.0888575, -13.4507575, -16.9771775, -8.9060255,
-8.634967, -13.750961, -8.435369, -4.731479, -11.715743, -16.752252,
-16.752252, -12.963094, -4.4797, -1.463899, -7.906436, -3.152959,
-3.391109, -12.930829, -14.488798, -16.752252, -6.469909, -15.831212,
-4.433538, -12.227548, -11.186935, -16.752252, -14.044114, -11.980335,
-14.957818, -11.995889, -9.870448, -3.886888, -12.473371, -16.752252,
-8.724162, -8.7089345, -12.8237805, -8.8060835, -5.3402075, -12.1008855,
-16.5511075, -16.5511075, -13.0755235, -2.8258155, -3.5159225,
-7.8480855, -3.4192395, -3.9034425, -12.3911935, -12.8279675,
-16.5511075, -6.1173955, -16.5511075, -5.5393875, -13.1495495,
-10.5958215, -16.5511075, -14.3079245, -11.4168585, -14.5230275,
-12.2255155, -10.8862915, -3.6071265, -11.2295815, -16.5511075,
-9.0285975, -8.718233, -12.411424, -8.425561, -5.109361, -12.150056,
-16.541389, -16.541389, -12.836315, -2.687709, -3.469224, -7.879879,
-3.214229, -3.658531, -12.144212, -12.668222, -16.541389, -6.090829,
-16.541389, -5.342092, -12.970741, -10.186492, -14.869239, -16.387516,
-11.085016, -14.030487, -13.375982, -10.042753, -3.512882, -11.498157,
-16.541389, -8.946685), .Dim = c(31L, 8L), .Dimnames = list(NULL,
     c("V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8")))

If I do
 > heatmap(a)
then I think this heatmap shows the data clustered along columns and 
along rows separately. The question is: how do I cluster data a along 
the columns first, then cluster along the rows of row-clustered data of 
a, and then draw the heatmap?

Thank you very much in advance,

D.



More information about the R-help mailing list