Question: hclustfun argument in heatmap.2 function
0
gravatar for carol white
10.4 years ago by
carol white680
European Union
carol white680 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]]
• 4.4k views
ADD COMMENTlink modified 10.4 years ago by Joern Toedling450 • written 10.4 years ago by carol white680
Answer: hclustfun argument in heatmap.2 function
0
gravatar for James W. MacDonald
10.4 years ago by
United States
James W. MacDonald52k wrote:
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 COMMENTlink written 10.4 years ago by James W. MacDonald52k
Answer: hclustfun argument in heatmap.2 function
0
gravatar for James W. MacDonald
10.4 years ago by
United States
James W. MacDonald52k wrote:
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 COMMENTlink written 10.4 years ago by James W. MacDonald52k
Answer: hclustfun argument in heatmap.2 function
0
gravatar for Joern Toedling
10.4 years ago by
Joern Toedling450 wrote:
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 COMMENTlink written 10.4 years ago by Joern Toedling450
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 212 users visited in the last hour