title: creating a heatmap where the data has NaN values in it
body: <p>I am trying to create a heatmap using the <code>heatmap.2</code> package. My data has lot's of <code>NaN</code> values in it, and what I would like to do is the following. Every time there is a <code>NaN</code> value, simply have the cell be colored as light grey (or some other neutral color, maybe white), and all of the other values (which are log2 expression) to have a standard green/yellow/red coloring scheme. Here is my code that I have ben using:</p>
  
  <pre><code>heatmap.2(as.matrix(foo2[rowSums (abs(foo2)) != 0,]),
            col = redgreen,
            margins = c(12, 22),
            trace = "none", 
            xlab = "Comparison",
            lhei = c(2, 8),
            scale = c("none"),
            symbreaks = min(foo2 = 0, na.rm = TRUE),
            na.color = "blue",
            cexRow = 0.5,
            cexCol = .7,
            main = "DE geness",
            Colv = F)
  </code></pre>
  
  <p>This works well when there is no <code>NaN</code> values, but when the data has <code>NaN</code>, I am getting an error which says:</p>
  
  <pre><code>Error in hclustfun(distfun(x)) : 
    NA/NaN/Inf in foreign function call (arg 11)
  </code></pre>
  
  <p>Essentially, I would like to have it ignore the <code>NaN</code>'s in the data. I am not sure how to handle this. any help would be greatly appreciated. </p>