title: pheatmap scale="row" giving Error in hclust(d, method = method) : NA/NaN/Inf in foreign function call
body: <p>I am trying to create a heatmap with gene expression values with the package pheatmap in R. I have used the code numerous times and never had a problem untill today. It seems when I do the scale="row" , I end up with this error. I cannot create the z-scores. So probably some rows have no variability for which this is happening. How can I get rid of this. The matrix is having 1100 rows and 9 columns. My code:</p>
  
  <pre><code>data  &lt;- read.table("~path/DEGs_DESeq.txt",sep="\t")
  data2 &lt;- as.matrix(data[,2:9])
  data3 &lt;- data2[-1,]
  samples &lt;- data2[1,]
  genes &lt;- data[2:length(data2[,1]),1]
  vett &lt;- as.numeric(data3)
  data4 &lt;- matrix(vett, length(genes), length(samples), dimnames=list(paste(genes),paste(samples))) 
  head(data4)
  
  pheatmap(as.matrix(data4), col=bluered(200), scale="row", key=T, keysize=1.5,
      density.info="none", trace="none",cexCol=0.6, fontsize_row=8, fontsize_col=10)
  </code></pre>
  
  <p><strong>Error in hclust(d, method = method) : 
    NA/NaN/Inf in foreign function call (arg 11)</strong></p>
  
  <p>How can I get rid of this error?</p>