[R] Dealing with missing values in HeatMap generation

Michael Dondrup michael.dondrup at cebitec.uni-bielefeld.de
Fri Apr 7 17:58:12 CEST 2006


Hi,
'g' must be a numeric matrix and obviously it's not (suspect it's character?). 
If 'g' is numeric in your example depends on how you read data into 
'filedata' and this step is missing in your code (maybe you just forgot to 
use read.table?). See ?read.table for that, and use argument colClasses if 
required. 


Am Friday 07 April 2006 17:01 schrieb Himanshu Ardawatia:
> Hi,
>
> I want to generate a heatmap for my data (in a matrix). However, the
> data has some missing values (represented as blank).
> I get the following errors (with the blanks and with blanks replaced by
>
> NA and including the option rm.na = TURE):
>  > filename = "input_heatmap.txt"
>  > g <- as.matrix(filedata)
>  > fg <- rainbow(nrow(g), start=0, end=.3)
>  > gg <- rainbow(ncol(g), start=0, end=.3)
>  > hg <- heatmap(g, col = cm.colors(256), scale="column",na.rm = TRUE,
>
> +  RowSideColors = fg, ColSideColors = gg, margin=c(5,10),
> + xlab = "Average per Species", ylab= "Pathways",
> + main = "heatmap(<Ka/Ks Average Data per Species>, ..., scale =
> \"column\")")
> Error in heatmap(g, col = cm.colors(256), scale = "column", na.rm = TRUE, 
> : 'x' must be a numeric matrix
>
> Is there anyway to deal with it?
>
> Second question: What is the basis for generation of the dendrogram
> (over the heatmap) in the heatmap? Is it simple hierarchical clustering?
>
> Thanks in advance
> Himanshu
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list