hclustfun argument in heatmap.2 function
3
0
Entering edit mode
carol white ▴ 680
@carol-white-2174
Last seen 9.5 years ago
European Union
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]]
• 8.0k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 hour ago
United States
Hi Carol, 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" The argument hclustfun expects you to pass a function name, not the output from calling the function you want to use (which is what you are doing). > myfun <- function(x) hclust(as.dist(1-cor(t(as.matrix(x)), method = "pearson")), method = "average") > heatmap.2(as.matrix(mtcars), dendrogram = "none", hclustfun = myfun) Best, Jim > > > 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]] > > > > -------------------------------------------------------------------- ---- > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 hour ago
United States
Hi Carol, 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" The argument hclustfun expects you to pass a function name, not the output from calling the function you want to use (which is what you are doing). > myfun <- function(x) hclust(as.dist(1-cor(t(as.matrix(x)), method = "pearson")), method = "average") > heatmap.2(as.matrix(mtcars), dendrogram = "none", hclustfun = myfun) Best, Jim > > > 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]] > > > > -------------------------------------------------------------------- ---- > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826
ADD COMMENT
0
Entering edit mode
@joern-toedling-3465
Last seen 10.2 years ago
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
ADD COMMENT

Login before adding your answer.

Traffic: 1040 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6