Hello,
that's because the argument hclustfun really expects a function (as
does
distfun), but you supply the result of the hierarchical clustering to
this
argument.
Try the following way:
hclust2 <- function(x, method="average", ...)
hclust(x, method=method, ...)
dist2 <- function(x, ...)
as.dist(1-cor(t(x), method="pearson"))
heatmap.2(as.matrix(mtcars), distfun=dist2, hclustfun=hclust2, <your other="" arguments="" here="">)
Regards,
Joern
PS: your R is very outdated, please upgrade to the current release
version
(2.9.1). And actually the package gplots is not a Bioconductor
package, so
maybe this list is not the right place to post such questions.
On Fri, 31 Jul 2009 04:43:04 -0700 (PDT), carol white wrote
> Hi,
> When using hclustfun argument in heatmap.2 function, I get the error
> message below. Note that I want to use average linkage with pearson
correlation.
>
> ?heatmap.2(as.matrix(mtcars), dendrogram = "none", hclustfun? =
> hclust(as.dist(1-cor(t(as.matrix(mtcars)), method = "pearson"))
> ,method = "average")) Error in heatmap.2(as.matrix(mtcars),
> dendrogram = "none", hclustfun = hclust(as.dist(1 -? : ??? could
> not find function "hclustfun"
>
> I use the R version
> ?????????
> > version ??? _??????????????????????????
> platform?????? x86_64-redhat-linux-gnu????
> arch?????????? x86_64?????????????????????
> os???????????? linux-gnu??????????????????
> system???????? x86_64, linux-gnu??????????
> status????????????????????????????????????
> major????????? 2??????????????????????????
> minor????????? 5.1????????????????????????
> year?????????? 2007???????????????????????
> month????????? 06?????????????????????????
> day??????????? 27?????????????????????????
> svn rev??????? 42083??????????????????????
> language?????? R??????????????????????????
> version.string R version 2.5.1 (2007-06-27)
>
> thanks,
>
> [[alternative HTML version deleted]]
---
Joern Toedling
Institut Curie -- U900
26 rue d'Ulm, 75005 Paris, FRANCE
Tel. +33 (0)156246926