[R] heatmap scale parameter question
David Carlson
dcarlson at tamu.edu
Wed Jul 31 17:53:26 CEST 2013
In your example all of the values are drawn from the same
distribution so there will not be substantial differences (row
means/variances and column means/variances will be
approximately the same).
set.seed(42)
d <- matrix(rnorm(100),nrow=20)
# Start with your example and modify the row/col means
rows <- sample.int(15:25, 20, replace=TRUE)
cols <- sample.int(5:15, 5, replace=TRUE)
d2 <- sweep(d, 2, cols, "+")
d2 <- sweep(d2, 1, rows, "+")
heatmap(d2, scale="none")
heatmap(d2, scale="row")
heatmap(d2, scale="col")
-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352
-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Witold E
Wolski
Sent: Wednesday, July 31, 2013 7:04 AM
To: r-help at r-project.org
Subject: [R] heatmap scale parameter question
Would anyone of the more experienced r-users explain to me the
behaviour of the scale parameter in the heatmap function.
different options for scale (R 3.0.1) do change only the
colors but do
not affect the dendrograms. Please see for yourself executing
the
following code:
d <- matrix(rnorm(100),nrow=20)
stats::heatmap(d)
X11()
heatmap(d,scale="column")
X11()
heatmap(d,scale="row")
X11()
heatmap(d,scale="none")
In all four above cases the dendrograms look exactly the same
However, scaling clearly affects clustering. see:
d <- scale(d)
heatmap(d,scale="none")
best regards
R version 3.0.1 (2013-05-16) -- "Good Sport"
ciao
--
Witold Eryk Wolski
--
Witold Eryk Wolski
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible
code.
More information about the R-help
mailing list